Fix object metadata view creation issue (#9875)
Fixes https://github.com/twentyhq/core-team-issues/issues/26 Fixes https://github.com/twentyhq/twenty/issues/9350
This commit is contained in:
@ -1,7 +1,5 @@
|
||||
import { useApolloClient, useMutation } from '@apollo/client';
|
||||
import { useMutation } from '@apollo/client';
|
||||
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useFindManyRecordsQuery } from '@/object-record/hooks/useFindManyRecordsQuery';
|
||||
import {
|
||||
CreateObjectInput,
|
||||
CreateOneObjectMetadataItemMutation,
|
||||
@ -15,14 +13,9 @@ import { useApolloMetadataClient } from './useApolloMetadataClient';
|
||||
|
||||
export const useCreateOneObjectMetadataItem = () => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const apolloClient = useApolloClient();
|
||||
const { refreshObjectMetadataItems } =
|
||||
useRefreshObjectMetadataItems('network-only');
|
||||
|
||||
const { findManyRecordsQuery } = useFindManyRecordsQuery({
|
||||
objectNameSingular: CoreObjectNameSingular.View,
|
||||
});
|
||||
|
||||
const [mutate] = useMutation<
|
||||
CreateOneObjectMetadataItemMutation,
|
||||
CreateOneObjectMetadataItemMutationVariables
|
||||
@ -42,15 +35,7 @@ export const useCreateOneObjectMetadataItem = () => {
|
||||
return createdObjectMetadata;
|
||||
};
|
||||
|
||||
const findManyRecordsCache = async () => {
|
||||
await apolloClient.query({
|
||||
query: findManyRecordsQuery,
|
||||
fetchPolicy: 'network-only',
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
createOneObjectMetadataItem,
|
||||
findManyRecordsCache,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user