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:
+1
-1
@@ -57,7 +57,7 @@ export const useOpenMergeRecordsPageInCommandMenu = ({
|
||||
objectRecordIds,
|
||||
});
|
||||
const { records } = await findManyRecordsLazy();
|
||||
upsertRecordsInStore(records ?? []);
|
||||
upsertRecordsInStore({ partialRecords: records ?? [] });
|
||||
|
||||
navigateCommandMenu({
|
||||
page: CommandMenuPages.MergeRecords,
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ export const CommandMenuCalendarEventPage = () => {
|
||||
recordGqlFields: FIND_ONE_CALENDAR_EVENT_OPERATION_SIGNATURE.fields,
|
||||
// TODO: this is not executed on sub-sequent runs, make sure that it is intended
|
||||
onCompleted: (record) => {
|
||||
upsertRecordsInStore([record]);
|
||||
upsertRecordsInStore({ partialRecords: [record] });
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ export const useEmailThreadInCommandMenu = () => {
|
||||
id: true,
|
||||
},
|
||||
onCompleted: (record) => {
|
||||
upsertRecordsInStore([record]);
|
||||
upsertRecordsInStore({ partialRecords: [record] });
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user