From d330f93bae29f95e197fe0f3b0122249b9fa66ec Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Sat, 19 Oct 2024 01:29:28 -0400 Subject: [PATCH] Revert "Add hack to prevent rerendering legacy views in development" This reverts commit 4d9ad8381fe8a11cdf3e9589228241c35366ff7f. --- src/components/viewManager/ViewManagerPage.tsx | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/components/viewManager/ViewManagerPage.tsx b/src/components/viewManager/ViewManagerPage.tsx index ada011a365..efba34f2d6 100644 --- a/src/components/viewManager/ViewManagerPage.tsx +++ b/src/components/viewManager/ViewManagerPage.tsx @@ -1,5 +1,5 @@ import { Action } from 'history'; -import { FunctionComponent, useEffect, useRef } from 'react'; +import { FunctionComponent, useEffect } from 'react'; import { useLocation, useNavigationType } from 'react-router-dom'; import globalize from 'lib/globalize'; @@ -58,13 +58,6 @@ const ViewManagerPage: FunctionComponent = ({ isThemeMediaSupported = false, transition }) => { - /** - * HACK: This is a hack to workaround intentional behavior in React strict mode when running in development. - * Legacy views will break if loaded twice so we need to avoid that. This will likely stop working in React 19. - * refs: https://stackoverflow.com/a/72238236 - */ - const isLoaded = useRef(false); - const location = useLocation(); const navigationType = useNavigationType(); @@ -98,11 +91,7 @@ const ViewManagerPage: FunctionComponent = ({ }); }; - if (!isLoaded.current) loadPage(); - - return () => { - isLoaded.current = true; - }; + loadPage(); }, // location.state and navigationType are NOT included as dependencies here since dialogs will update state while the current view stays the same // eslint-disable-next-line react-hooks/exhaustive-deps