Fix opportunity relation (#3478)

* Fix opportunity relation

* Fix

* Fix

* Fix tests

* Fix

* Fix
This commit is contained in:
Charles Bochet
2024-01-16 14:39:48 +01:00
committed by GitHub
parent bf67f07291
commit fb93bb69fb
24 changed files with 372 additions and 321 deletions

View File

@ -1,5 +1,5 @@
import { useApolloClient } from '@apollo/client';
import { Modifiers } from '@apollo/client/cache';
import { Modifier, Reference } from '@apollo/client/cache';
import { EMPTY_MUTATION } from '@/object-metadata/hooks/useObjectMetadataItem';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
@ -12,7 +12,10 @@ export const useModifyRecordFromCache = ({
}) => {
const apolloClient = useApolloClient();
return (recordId: string, fieldModifiers: Modifiers) => {
return (
recordId: string,
fieldModifiers: Record<string, Modifier<Reference>>,
) => {
if (!objectMetadataItem) {
return EMPTY_MUTATION;
}
@ -23,7 +26,7 @@ export const useModifyRecordFromCache = ({
id: recordId,
});
cache.modify({
cache.modify<Record<string, Reference>>({
id: cachedRecordId,
fields: fieldModifiers,
});