[REFACTOR][BUG] Dynamically compute field to write in cache CREATE (#10130)
# Introduction While importing records encountering missing expected fields when writting a fragment from apollo cache ## Updates ### 1/ `createdBy` Default value When inserting in cache in create single or many we will now make optimistic behavior on the createdBy value ### 2/ `createRecordInCache` dynamically create `recordGrqlFields` When creating an entry in cache, we will now dynamically generate fields to be written in the fragment instead of expecting all of them. As by nature record could be partial ### 3/ Strictly typed `RecordGqlFields` # Conclusion closes #9927
This commit is contained in:
@ -23,11 +23,12 @@ export const usePrefetchedData = <T extends ObjectRecord>(
|
||||
objectNameSingular,
|
||||
});
|
||||
|
||||
const recordGqlFields =
|
||||
operationSignatureFactory({ objectMetadataItem }).fields ?? filter;
|
||||
const { records } = useFindManyRecords<T>({
|
||||
skip: !isDataPrefetched,
|
||||
objectNameSingular: objectNameSingular,
|
||||
recordGqlFields:
|
||||
operationSignatureFactory({ objectMetadataItem }).fields ?? filter,
|
||||
recordGqlFields,
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user