* wip

* Fix viewsé
This commit is contained in:
Charles Bochet
2023-11-24 16:32:59 +01:00
committed by GitHub
parent 886acd1cec
commit 8212606043
24 changed files with 428 additions and 299 deletions
@@ -41,7 +41,7 @@ export const useFindManyObjectRecords = <
skip?: boolean;
}) => {
const findManyQueryStateIdentifier =
objectNamePlural + JSON.stringify(filter);
objectNamePlural + JSON.stringify(filter) + JSON.stringify(orderBy) + limit;
const [lastCursor, setLastCursor] = useRecoilState(
cursorFamilyState(findManyQueryStateIdentifier),
@@ -1,4 +1,4 @@
import { useApolloClient, useMutation } from '@apollo/client';
import { useMutation } from '@apollo/client';
import { getOperationName } from '@apollo/client/utilities';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
@@ -12,14 +12,12 @@ export const useUpdateOneObjectRecord = <T>({
objectMetadataItem: foundObjectMetadataItem,
objectNotFoundInMetadata,
updateOneMutation,
cacheFragment,
getRecordFromCache,
findManyQuery,
} = useObjectMetadataItem({
objectNameSingular,
});
const { cache } = useApolloClient();
// TODO: type this with a minimal type at least with Record<string, any>
const [mutate] = useMutation(updateOneMutation);
@@ -36,14 +34,7 @@ export const useUpdateOneObjectRecord = <T>({
return null;
}
const cachedRecordId = cache.identify({
__typename: capitalize(foundObjectMetadataItem?.nameSingular ?? ''),
id: idToUpdate,
});
const cachedRecord = cache.readFragment({
id: cachedRecordId,
fragment: cacheFragment,
});
const cachedRecord = getRecordFromCache(idToUpdate);
const updatedObject = await mutate({
variables: {