Fix Apollo client routing for view operations in field metadata hooks (#13012)

closes https://github.com/twentyhq/twenty/issues/13010
This commit is contained in:
nitin
2025-07-03 02:40:26 +05:30
committed by GitHub
parent 41becaaea4
commit 3801785d02
2 changed files with 7 additions and 4 deletions
@@ -1,10 +1,11 @@
import { useApolloClient, useMutation } from '@apollo/client';
import { useMutation } from '@apollo/client';
import {
DeleteOneFieldMetadataItemMutation,
DeleteOneFieldMetadataItemMutationVariables,
} from '~/generated-metadata/graphql';
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
import { useRefreshObjectMetadataItems } from '@/object-metadata/hooks/useRefreshObjectMetadataItem';
import { recordIndexKanbanAggregateOperationState } from '@/object-record/record-index/states/recordIndexKanbanAggregateOperationState';
import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
@@ -25,7 +26,7 @@ export const useDeleteOneFieldMetadataItem = () => {
setRecordIndexKanbanAggregateOperation,
] = useRecoilState(recordIndexKanbanAggregateOperationState);
const apolloClient = useApolloClient();
const apolloCoreClient = useApolloCoreClient();
const resetRecordIndexKanbanAggregateOperation = async (
idToDelete: DeleteOneFieldMetadataItemMutationVariables['idToDelete'],
@@ -36,7 +37,7 @@ export const useDeleteOneFieldMetadataItem = () => {
fieldMetadataId: null,
});
}
await apolloClient.refetchQueries({
await apolloCoreClient.refetchQueries({
include: ['FindManyViews'],
});
};