The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix person deletion not reflected on Opportunities POC (#1387)
Charles Bochet2d5cb9c75071
diff --git a/front/src/modules/companies/hooks/useDeleteCompanies.ts b/front/src/modules/companies/hooks/useDeleteCompanies.tsindex 56687fb891f..87f741ee995 100644--- a/front/src/modules/companies/hooks/useDeleteCompanies.ts+++ b/front/src/modules/companies/hooks/useDeleteCompanies.ts@@ -38,14 +38,11 @@ export function useDeleteSelectedComapnies() {tableRowIds.filter((id) => !rowIdsToDelete.includes(id)),);- // Manually update the cache to match the mutationsrowIdsToDelete.forEach((companyId) => {cache.evict({- id: cache.identify({- __typename: 'Company',- id: companyId,- }),+ id: cache.identify({ __typename: 'Company', id: companyId }),});+ cache.gc();});},});diff --git a/front/src/modules/people/hooks/usePersonTableActionBarEntries.tsx b/front/src/modules/people/hooks/usePersonTableActionBarEntries.tsxindex 0e3068e1de5..243990417ff 100644--- a/front/src/modules/people/hooks/usePersonTableActionBarEntries.tsx+++ b/front/src/modules/people/hooks/usePersonTableActionBarEntries.tsx@@ -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();+ });},});}diff --git a/front/src/pages/settings/SettingsWorkspaceMembers.tsx b/front/src/pages/settings/SettingsWorkspaceMembers.tsxindex 8ce26292e1f..c5ba14ea9c5 100644--- a/front/src/pages/settings/SettingsWorkspaceMembers.tsx+++ b/front/src/pages/settings/SettingsWorkspaceMembers.tsx@@ -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 objectcache.gc();},});