mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-18 17:12:53 +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)),
|
tableRowIds.filter((id) => !rowIdsToDelete.includes(id)),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Manually update the cache to match the mutations
|
|
||||||
rowIdsToDelete.forEach((companyId) => {
|
rowIdsToDelete.forEach((companyId) => {
|
||||||
cache.evict({
|
cache.evict({
|
||||||
id: cache.identify({
|
id: cache.identify({ __typename: 'Company', id: companyId }),
|
||||||
__typename: 'Company',
|
|
||||||
id: companyId,
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
cache.gc();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -47,10 +47,14 @@ export function usePersonTableActionBarEntries() {
|
|||||||
count: rowIdsToDelete.length,
|
count: rowIdsToDelete.length,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: () => {
|
update: (cache) => {
|
||||||
setTableRowIds(
|
setTableRowIds(
|
||||||
tableRowIds.filter((id) => !rowIdsToDelete.includes(id)),
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const normalizedId = cache.identify({
|
cache.evict({
|
||||||
id: responseData.deleteWorkspaceMember.id,
|
id: cache.identify({
|
||||||
__typename: 'WorkspaceMember',
|
id: responseData.deleteWorkspaceMember.id,
|
||||||
|
__typename: 'WorkspaceMember',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Evict object from cache
|
cache.evict({
|
||||||
cache.evict({ id: normalizedId });
|
id: cache.identify({
|
||||||
|
id: userId,
|
||||||
|
__typename: 'User',
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
// Clean up relation to this object
|
|
||||||
cache.gc();
|
cache.gc();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user