From 032f849092c8518bc418810346ebf682238ed55c Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 6 May 2024 18:06:31 -0700 Subject: [PATCH] Protect against missing element --- src/App.web.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/App.web.tsx b/src/App.web.tsx index 39790a44..9c2b34a7 100644 --- a/src/App.web.tsx +++ b/src/App.web.tsx @@ -110,15 +110,14 @@ function InnerApp() { function App() { const [isReady, setReady] = useState(false) - + React.useEffect(() => { initPersistedState().then(() => { setReady(true) - - const preloadElement = document.getElementById('preload'); - preloadElement.remove(); + + const preloadElement = document.getElementById('preload') + preloadElement?.remove() }) - }, []) if (!isReady) {