Skip to content

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

fix state update on unmounted component

ThieryMichelf73b83556c10
diff --git a/src/components/atomic-crm/root/CRM.tsx b/src/components/atomic-crm/root/CRM.tsx
index 14dfc5a3..0d3eb866 100644
--- a/src/components/atomic-crm/root/CRM.tsx
+++ b/src/components/atomic-crm/root/CRM.tsx
@@ -148,22 +148,25 @@ export const CRM = ({
// Seed the store with CRM prop values if not already stored
// (backwards compatibility for prop-based config)
- if (!store.getItem(CONFIGURATION_STORE_KEY)) {
- store.setItem(CONFIGURATION_STORE_KEY, {
- companySectors,
- currency,
- dealCategories,
- dealPipelineStatuses,
- dealStages,
- noteStatuses,
- taskTypes,
- title,
- darkModeLogo,
- lightModeLogo,
- googleWorkplaceDomain,
- disableEmailPasswordAuthentication,
- } satisfies ConfigurationContextValue);
- }
+ useEffect(() => {
+ if (!store.getItem(CONFIGURATION_STORE_KEY)) {
+ store.setItem(CONFIGURATION_STORE_KEY, {
+ companySectors,
+ currency,
+ dealCategories,
+ dealPipelineStatuses,
+ dealStages,
+ noteStatuses,
+ taskTypes,
+ title,
+ darkModeLogo,
+ lightModeLogo,
+ googleWorkplaceDomain,
+ disableEmailPasswordAuthentication,
+ } satisfies ConfigurationContextValue);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
const isMobile = useIsMobile();