Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

[Demo] Fix wrong contact pending tasks when marking as done and deleting task

fzaninotto1c1154589a10
diff --git a/src/components/atomic-crm/providers/fakerest/dataProvider.ts b/src/components/atomic-crm/providers/fakerest/dataProvider.ts
index 37f3c5b5..5180e4cf 100644
--- a/src/components/atomic-crm/providers/fakerest/dataProvider.ts
+++ b/src/components/atomic-crm/providers/fakerest/dataProvider.ts
@@ -547,6 +547,10 @@ export const createDataProvider = ({
afterDelete: async (result, dataProvider) => {
// update the task count in the related contact
const { contact_id } = result.data;
+ if (result.data.done_date) {
+ // if the task is done, we don't need to update the contact's nb of active tasks
+ return result;
+ }
const { data: contact } = await dataProvider.getOne("contacts", {
id: contact_id,
});