Skip to content

Commit

Permalink
little fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ijreilly committed Dec 16, 2024
1 parent b7d962d commit 9011166
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 16 deletions.
5 changes: 2 additions & 3 deletions packages/twenty-front/src/hooks/useScrollRestoration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect } from 'react';
import { useLocation, useNavigation } from 'react-router-dom';
import { useNavigation } from 'react-router-dom';

import { scrollWrapperInstanceComponentState } from '@/ui/utilities/scroll/states/scrollWrapperInstanceComponentState';
import { scrollWrapperScrollTopComponentState } from '@/ui/utilities/scroll/states/scrollWrapperScrollTopComponentState';
Expand All @@ -14,7 +14,6 @@ import { isDefined } from '~/utils/isDefined';
* not share the same scroll position.
*/
export const useScrollRestoration = (viewportHeight?: number) => {
const key = `scroll-position-${useLocation().key}`;
const { state } = useNavigation();

const [scrollTop, setScrollTop] = useRecoilComponentStateV2(
Expand All @@ -34,5 +33,5 @@ export const useScrollRestoration = (viewportHeight?: number) => {
} else if (state === 'idle' && isDefined(scrollWrapper) && !skip) {
scrollWrapper.scrollTo({ top: scrollTop });
}
}, [key, state, scrollWrapper, skip, scrollTop, setScrollTop]);
}, [state, scrollWrapper, skip, scrollTop, setScrollTop]);
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { useCurrentRecordGroupDefinition } from '@/object-record/record-group/ho
import { useMemo } from 'react';
import { isDefined } from 'twenty-ui';

export const useRecordGroupFilter = (fields?: FieldMetadataItem[]) => {
export const useRecordGroupFilter = (fields: FieldMetadataItem[]) => {
const currentRecordGroupDefinition = useCurrentRecordGroupDefinition();

const recordGroupFilter = useMemo(() => {
if (isDefined(currentRecordGroupDefinition)) {
const fieldMetadataItem = fields?.find(
const fieldMetadataItem = fields.find(
(fieldMetadataItem) =>
fieldMetadataItem.id === currentRecordGroupDefinition.fieldMetadataId,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,8 @@ export const RecordTable = () => {
<RecordTableRecordGroupsBody />
)}
<RecordTableStickyEffect />
{isAggregateQueryEnabled === true && !hasRecordGroups ? (
{isAggregateQueryEnabled && !hasRecordGroups && (
<RecordTableFooter />
) : (
<></>
)}
</StyledTable>
<DragSelect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ export const RecordTableRecordGroupRows = () => {
);
})}
<RecordTablePendingRecordGroupRow />
<RecordTableRecordGroupSectionLoadMore />
<RecordTableRecordGroupSectionAddNew />
{isAggregateQueryEnabled === true && (
{isAggregateQueryEnabled && (
<RecordTableFooter
key={currentRecordGroupId}
currentRecordGroupId={currentRecordGroupId}
/>
)}
<RecordTableRecordGroupSectionLoadMore />
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const RecordTableFooterCell = ({
currentRecordGroupId,
}: {
column: ColumnDefinition<FieldMetadata>;
isFirstCell: boolean;
isFirstCell?: boolean;
currentRecordGroupId?: string;
}) => {
const tableColumns = useRecoilComponentValueV2(tableColumnsComponentState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export const useAggregateRecordsForRecordTableColumnFooter = (
'IS_AGGREGATE_QUERY_ENABLED',
);
const { objectMetadataItem } = useRecordTableContextOrThrow();
const { recordGroupFilter } = useRecordGroupFilter(
objectMetadataItem?.fields,
);
const { recordGroupFilter } = useRecordGroupFilter(objectMetadataItem.fields);

const { currentViewWithSavedFiltersAndSorts } = useGetCurrentView();
const recordIndexViewFilterGroups = useRecoilValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const SettingsPageContainer = ({
}) => (
<ScrollWrapper
contextProviderName="settingsPageContainer"
componentInstanceId={`scroll-wrapper-settings-page-container`}
componentInstanceId={'scroll-wrapper-settings-page-container'}
>
<StyledSettingsPageContainer>{children}</StyledSettingsPageContainer>
</ScrollWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ShowPageContainer = ({ children }: ShowPageContainerProps) => {
<StyledOuterContainer>
<StyledScrollWrapper
contextProviderName="showPageContainer"
componentInstanceId={`scroll-wrapper-show-page-container`}
componentInstanceId={'scroll-wrapper-show-page-container'}
>
<StyledInnerContainer>{children}</StyledInnerContainer>
</StyledScrollWrapper>
Expand Down

0 comments on commit 9011166

Please sign in to comment.