Skip to content

Commit

Permalink
Ensure shellHooksStore and shellAlertsStore are only created if not a…
Browse files Browse the repository at this point in the history
…lready defined on the global window object
  • Loading branch information
hervedombya committed Jan 16, 2025
1 parent b26a720 commit 4095188
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ModuleFederation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,13 @@ const createShellAlertsStore = <T extends { shellAlerts: any }>() => {
};
};

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;
Expand Down

0 comments on commit 4095188

Please sign in to comment.