Skip to content

Commit

Permalink
[@mantine/utils] Fix incorrect ssr logic for create-use-external-events
Browse files Browse the repository at this point in the history
  • Loading branch information
rtivital committed Aug 11, 2022
1 parent de741b5 commit 5b3d7e9
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -14,10 +14,12 @@ export function createUseExternalEvents<Handlers extends Record<string, (detail:
}, {});

useMemo(() => {
Object.keys(handlers).forEach((eventKey) => {
window.removeEventListener(eventKey, handlers[eventKey]);
window.addEventListener(eventKey, handlers[eventKey]);
});
if (typeof window !== 'undefined') {
Object.keys(handlers).forEach((eventKey) => {
window.removeEventListener(eventKey, handlers[eventKey]);
window.addEventListener(eventKey, handlers[eventKey]);
});
}
}, []);

useEffect(
Expand Down

0 comments on commit 5b3d7e9

Please sign in to comment.