A full-featured CRM built with React, shadcn/ui, and Supabase.
fix(contacts): drop the redundant importer ref in ContactImportProvider
Jerome316fe1a20aa8
diff --git a/src/components/atomic-crm/contacts/ContactImportProvider.tsx b/src/components/atomic-crm/contacts/ContactImportProvider.tsxindex 74b0a74d..8c3fc3b2 100644--- a/src/components/atomic-crm/contacts/ContactImportProvider.tsx+++ b/src/components/atomic-crm/contacts/ContactImportProvider.tsx@@ -5,7 +5,6 @@ import {useContext,useEffect,useMemo,- useRef,useState,type ReactNode,} from "react";@@ -63,26 +62,21 @@ export const ContactImportProvider = ({});const [isDialogOpen, setIsDialogOpen] = useState(false);- const importerRef = useRef(importer);- importerRef.current = importer;-useEffect(() => {if (importer.state === "complete") {- const finished = importerRef.current;- if (finished.state !== "complete") return;refresh();notify("resources.contacts.import.complete", {type: "success",messageArgs: {- importCount: finished.importCount,- errorCount: finished.errorCount,+ importCount: importer.importCount,+ errorCount: importer.errorCount,},});}if (importer.state === "error") {notify("resources.contacts.import.error", { type: "error" });}- }, [importer.state, notify, refresh]);+ }, [importer, notify, refresh]);const isImporting =importer.state === "parsing" || importer.state === "running";