Removed sort definitions (#10368)
This PR focuses on complete removal of sort definitions.
This commit is contained in:
@ -96,11 +96,6 @@ describe('useApplyCurrentViewSortsToCurrentRecordSorts', () => {
|
||||
id: mockViewSort.id,
|
||||
fieldMetadataId: mockViewSort.fieldMetadataId,
|
||||
direction: mockViewSort.direction,
|
||||
definition: {
|
||||
fieldMetadataId: mockViewSort.fieldMetadataId,
|
||||
iconName: mockFieldMetadataItem.icon ?? '',
|
||||
label: mockFieldMetadataItem.label,
|
||||
},
|
||||
} satisfies RecordSort,
|
||||
]);
|
||||
});
|
||||
|
||||
@ -70,11 +70,6 @@ describe('useApplyViewSortsToCurrentRecordSorts', () => {
|
||||
id: mockViewSort.id,
|
||||
fieldMetadataId: mockViewSort.fieldMetadataId,
|
||||
direction: mockViewSort.direction,
|
||||
definition: {
|
||||
fieldMetadataId: mockViewSort.fieldMetadataId,
|
||||
label: mockFieldMetadataItem.label,
|
||||
iconName: mockFieldMetadataItem.icon ?? '',
|
||||
},
|
||||
} satisfies RecordSort,
|
||||
]);
|
||||
});
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
|
||||
import { formatFieldMetadataItemsAsSortDefinitions } from '@/object-metadata/utils/formatFieldMetadataItemsAsSortDefinitions';
|
||||
import { useSortableFieldMetadataItemsInRecordIndexContext } from '@/object-record/record-sort/hooks/useSortableFieldMetadataItemsInRecordIndexContext';
|
||||
import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState';
|
||||
import { prefetchViewFromViewIdFamilySelector } from '@/prefetch/states/selector/prefetchViewFromViewIdFamilySelector';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
@ -25,18 +23,9 @@ export const useApplyCurrentViewSortsToCurrentRecordSorts = () => {
|
||||
currentRecordSortsComponentState,
|
||||
);
|
||||
|
||||
const { sortableFieldMetadataItems } =
|
||||
useSortableFieldMetadataItemsInRecordIndexContext();
|
||||
|
||||
const applyCurrentViewSortsToCurrentRecordSorts = () => {
|
||||
const sortDefinitions = formatFieldMetadataItemsAsSortDefinitions({
|
||||
fields: sortableFieldMetadataItems,
|
||||
});
|
||||
|
||||
if (isDefined(currentView)) {
|
||||
setCurrentRecordSorts(
|
||||
mapViewSortsToSorts(currentView.viewSorts, sortDefinitions),
|
||||
);
|
||||
setCurrentRecordSorts(mapViewSortsToSorts(currentView.viewSorts));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import { formatFieldMetadataItemsAsSortDefinitions } from '@/object-metadata/utils/formatFieldMetadataItemsAsSortDefinitions';
|
||||
import { useSortableFieldMetadataItemsInRecordIndexContext } from '@/object-record/record-sort/hooks/useSortableFieldMetadataItemsInRecordIndexContext';
|
||||
import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState';
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import { ViewSort } from '@/views/types/ViewSort';
|
||||
@ -10,15 +8,8 @@ export const useApplyViewSortsToCurrentRecordSorts = () => {
|
||||
currentRecordSortsComponentState,
|
||||
);
|
||||
|
||||
const { sortableFieldMetadataItems } =
|
||||
useSortableFieldMetadataItemsInRecordIndexContext();
|
||||
|
||||
const applyViewSortsToCurrentRecordSorts = (viewSorts: ViewSort[]) => {
|
||||
const sortDefinitions = formatFieldMetadataItemsAsSortDefinitions({
|
||||
fields: sortableFieldMetadataItems,
|
||||
});
|
||||
|
||||
const recordSortsToApply = mapViewSortsToSorts(viewSorts, sortDefinitions);
|
||||
const recordSortsToApply = mapViewSortsToSorts(viewSorts);
|
||||
|
||||
setCurrentRecordSorts(recordSortsToApply);
|
||||
};
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import { availableFieldDefinitionsComponentState } from '@/views/states/availableFieldDefinitionsComponentState';
|
||||
import { availableSortDefinitionsComponentState } from '@/views/states/availableSortDefinitionsComponentState';
|
||||
import { viewObjectMetadataIdComponentState } from '@/views/states/viewObjectMetadataIdComponentState';
|
||||
|
||||
export const useInitViewBar = (viewBarInstanceId?: string) => {
|
||||
@ -9,11 +8,6 @@ export const useInitViewBar = (viewBarInstanceId?: string) => {
|
||||
viewBarInstanceId,
|
||||
);
|
||||
|
||||
const setAvailableSortDefinitions = useSetRecoilComponentStateV2(
|
||||
availableSortDefinitionsComponentState,
|
||||
viewBarInstanceId,
|
||||
);
|
||||
|
||||
const setViewObjectMetadataId = useSetRecoilComponentStateV2(
|
||||
viewObjectMetadataIdComponentState,
|
||||
viewBarInstanceId,
|
||||
@ -21,7 +15,6 @@ export const useInitViewBar = (viewBarInstanceId?: string) => {
|
||||
|
||||
return {
|
||||
setAvailableFieldDefinitions,
|
||||
setAvailableSortDefinitions,
|
||||
setViewObjectMetadataId,
|
||||
};
|
||||
};
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { useRecoilCallback } from 'recoil';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
|
||||
import { RecordSort } from '@/object-record/record-sort/types/RecordSort';
|
||||
@ -103,7 +102,6 @@ export const useUpsertCombinedViewSorts = (viewBarComponentId?: string) => {
|
||||
...unsavedToUpsertViewSorts,
|
||||
{
|
||||
...upsertedSort,
|
||||
id: v4(),
|
||||
__typename: 'ViewSort',
|
||||
} satisfies ViewSort,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user