Refactor upsertRecordsInStore to accept an object with partialRecords (#16707)
Fixes https://github.com/twentyhq/twenty/issues/16624 Original issue: - while persisting a field (calling useUpdateOne), the response from the backend is missing the taskTargets many to many (same for note). As we optimistically update the cache, we lose the "Relations" in the UI - I'm changing the behavior of useUpsertInRecordStore to accept recordGqlFields to only update the fields we want in the record store (this way, we are not losing the targets information in our case)
This commit is contained in:
@@ -148,12 +148,14 @@ export const useActivateWorkflowVersion = () => {
|
||||
statuses: () => Array.from(newStatuses),
|
||||
},
|
||||
});
|
||||
upsertRecordsInStore([
|
||||
{
|
||||
...cachedWorkflow,
|
||||
statuses: Array.from(newStatuses) as WorkflowStatus[],
|
||||
},
|
||||
]);
|
||||
upsertRecordsInStore({
|
||||
partialRecords: [
|
||||
{
|
||||
...cachedWorkflow,
|
||||
statuses: Array.from(newStatuses) as WorkflowStatus[],
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user