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,4 +1,4 @@
import { useApolloClient } from '@apollo/client';
import { Reference, useApolloClient } from '@apollo/client';
import { useRecoilCallback } from 'recoil';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
@ -127,18 +127,22 @@ export const useViewFields = (viewScopeId: string) => {
}
modifyRecordFromCache(viewIdToPersist ?? '', {
viewFields: () => ({
edges: viewFieldsToPersist.map((viewField) => ({
node: viewField,
cursor: '',
})),
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: '',
endCursor: '',
},
}),
viewFields: (viewFieldsRef, { readField }) => {
const edges = readField<{ node: Reference }[]>(
'edges',
viewFieldsRef,
);
if (!edges) return viewFieldsRef;
return {
...viewFieldsRef,
edges: viewFieldsToPersist.map((viewField) => ({
node: viewField,
cursor: '',
})),
};
},
});
onViewFieldsChange?.(viewFieldsToPersist);