From 0eeaa2db9082e2d8d7de55822d10efa8fc2b7d63 Mon Sep 17 00:00:00 2001 From: tyleroooo Date: Wed, 15 Jan 2025 19:14:47 -0500 Subject: [PATCH] fix(bonsai-core): online handler is on window (#1440) --- src/hooks/useInitializePage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/useInitializePage.ts b/src/hooks/useInitializePage.ts index 6b5523315..17bd90713 100644 --- a/src/hooks/useInitializePage.ts +++ b/src/hooks/useInitializePage.ts @@ -71,9 +71,9 @@ export const useInitializePage = () => { IndexerWebsocketManager.getActiveResources().forEach((r) => r.restart()); logAbacusTsInfo('useInitializePage', 'restarting because network status change'); }; - document.addEventListener('online', handleOnline); + window.addEventListener('online', handleOnline); return () => { - document.removeEventListener('online', handleOnline); + window.removeEventListener('online', handleOnline); }; }, [localStorageNetwork]); };