mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-18 09:02:11 +03:00
Fix person deletion not reflected on Opportunities POC (#1387)
* Fix person deletion not reflected on Opportunities POC * Fix companies, user deletion
This commit is contained in:
parent
ec23ca3d12
commit
2d5cb9c750
@ -38,14 +38,11 @@ export function useDeleteSelectedComapnies() {
|
||||
tableRowIds.filter((id) => !rowIdsToDelete.includes(id)),
|
||||
);
|
||||
|
||||
// Manually update the cache to match the mutations
|
||||
rowIdsToDelete.forEach((companyId) => {
|
||||
cache.evict({
|
||||
id: cache.identify({
|
||||
__typename: 'Company',
|
||||
id: companyId,
|
||||
}),
|
||||
id: cache.identify({ __typename: 'Company', id: companyId }),
|
||||
});
|
||||
cache.gc();
|
||||
});
|
||||
},
|
||||
});
|
||||
|
@ -47,10 +47,14 @@ export function usePersonTableActionBarEntries() {
|
||||
count: rowIdsToDelete.length,
|
||||
},
|
||||
},
|
||||
update: () => {
|
||||
update: (cache) => {
|
||||
setTableRowIds(
|
||||
tableRowIds.filter((id) => !rowIdsToDelete.includes(id)),
|
||||
);
|
||||
rowIdsToDelete.forEach((id) => {
|
||||
cache.evict({ id: cache.identify({ id, __typename: 'Person' }) });
|
||||
cache.gc();
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -64,15 +64,20 @@ export function SettingsWorkspaceMembers() {
|
||||
return;
|
||||
}
|
||||
|
||||
const normalizedId = cache.identify({
|
||||
id: responseData.deleteWorkspaceMember.id,
|
||||
__typename: 'WorkspaceMember',
|
||||
cache.evict({
|
||||
id: cache.identify({
|
||||
id: responseData.deleteWorkspaceMember.id,
|
||||
__typename: 'WorkspaceMember',
|
||||
}),
|
||||
});
|
||||
|
||||
// Evict object from cache
|
||||
cache.evict({ id: normalizedId });
|
||||
cache.evict({
|
||||
id: cache.identify({
|
||||
id: userId,
|
||||
__typename: 'User',
|
||||
}),
|
||||
});
|
||||
|
||||
// Clean up relation to this object
|
||||
cache.gc();
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user