diff --git a/src/app.jsx b/src/app.jsx index 9ffeb119..16109f4c 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -201,9 +201,12 @@ function App() { const { prevLocation } = snapStates; const backgroundLocation = useRef(prevLocation || null); - const isModalPage = - matchPath('/:instance/s/:id', location.pathname) || - matchPath('/s/:id', location.pathname); + const isModalPage = useMemo(() => { + return ( + matchPath('/:instance/s/:id', location.pathname) || + matchPath('/s/:id', location.pathname) + ); + }, [location.pathname, matchPath]); if (isModalPage) { if (!backgroundLocation.current) backgroundLocation.current = prevLocation; } else {