Skip to content

The open alternative to Salesforce, designed for AI.

Fix: Manually delete company cache #1214 (#1315)

ABHISHEK PATEL9027a7dd1e7e
diff --git a/front/src/modules/companies/hooks/useDeleteCompanies.ts b/front/src/modules/companies/hooks/useDeleteCompanies.ts
index 67b21b220a4..56687fb891f 100644
--- a/front/src/modules/companies/hooks/useDeleteCompanies.ts
+++ b/front/src/modules/companies/hooks/useDeleteCompanies.ts
@@ -33,10 +33,20 @@ export function useDeleteSelectedComapnies() {
count: rowIdsToDelete.length,
},
},
- update: () => {
+ update: (cache) => {
setTableRowIds(
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,
+ }),
+ });
+ });
},
});
}