Add ability to save any field filter to view (#13401)
This PR adds the ability to save an any field filter to a view. It adds a new `anyFieldFilterValue` on both core view and workspace view entities. It also introduces the necessary utils that mimic the logic that manages the save of record filters and record sorts on views.
This commit is contained in:
@@ -3,6 +3,7 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi
|
||||
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
|
||||
import { useLazyFindManyRecords } from '@/object-record/hooks/useLazyFindManyRecords';
|
||||
import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState';
|
||||
import { anyFieldFilterValueComponentState } from '@/object-record/record-filter/states/anyFieldFilterValueComponentState';
|
||||
import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState';
|
||||
import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';
|
||||
import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState';
|
||||
@@ -40,6 +41,10 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => {
|
||||
objectNameSingular: CoreObjectNameSingular.View,
|
||||
});
|
||||
|
||||
const anyFieldFilterValue = useRecoilComponentValueV2(
|
||||
anyFieldFilterValueComponentState,
|
||||
);
|
||||
|
||||
const { createViewFieldRecords } = usePersistViewFieldRecords();
|
||||
|
||||
const { createViewSortRecords } = usePersistViewSortRecords();
|
||||
@@ -126,6 +131,7 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => {
|
||||
type: type ?? sourceView.type,
|
||||
objectMetadataId: sourceView.objectMetadataId,
|
||||
openRecordIn: sourceView.openRecordIn,
|
||||
anyFieldFilterValue: anyFieldFilterValue,
|
||||
});
|
||||
|
||||
if (isUndefinedOrNull(newView)) {
|
||||
@@ -209,6 +215,7 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => {
|
||||
set(isPersistingViewFieldsState, false);
|
||||
},
|
||||
[
|
||||
anyFieldFilterValue,
|
||||
currentViewIdCallbackState,
|
||||
createOneRecord,
|
||||
createViewFieldRecords,
|
||||
|
||||
Reference in New Issue
Block a user