From 4095188a232365f3e258a2acbca6003bca41e239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Dombya?= <135591453+hervedombya@users.noreply.github.com> Date: Thu, 16 Jan 2025 17:35:33 +0100 Subject: [PATCH] Ensure shellHooksStore and shellAlertsStore are only created if not already defined on the global window object --- src/ModuleFederation.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ModuleFederation.tsx b/src/ModuleFederation.tsx index a7eea7f..bce8519 100644 --- a/src/ModuleFederation.tsx +++ b/src/ModuleFederation.tsx @@ -235,8 +235,13 @@ const createShellAlertsStore = () => { }; }; -window.shellHooksStore = createShellHooksStore(); -window.shellAlertsStore = createShellAlertsStore(); +if (!window.shellHooksStore) { + window.shellHooksStore = createShellHooksStore(); +} + +if (!window.shellAlertsStore) { + window.shellAlertsStore = createShellAlertsStore(); +} export const shellHooksStore = window.shellHooksStore; export const shellAlertsStore = window.shellAlertsStore;