diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsx index b21389e3d4dcdac828b4b68b3e7f1c69cf922a26..a7fbeb3395bedfac5ae1060cb03780e47c5c55d8 100644 --- a/apps/web/src/routes/__root.tsx +++ b/apps/web/src/routes/__root.tsx @@ -127,8 +127,10 @@ function EventRouter() { const queryClient = useQueryClient(); const navigate = useNavigate(); const pathname = useRouterState({ select: (state) => state.location.pathname }); + const pathnameRef = useRef(pathname); const lastConfigIssuesSignatureRef = useRef(null); const handledBootstrapThreadIdRef = useRef(null); + pathnameRef.current = pathname; useEffect(() => { const api = readNativeApi(); @@ -201,7 +203,7 @@ function EventRouter() { projectId: payload.bootstrapProjectId, expanded: true, }); - if (pathname !== "/") { + if (pathnameRef.current !== "/") { return; } if (handledBootstrapThreadIdRef.current === payload.bootstrapThreadId) { @@ -264,7 +266,7 @@ function EventRouter() { unsubWelcome(); unsubServerConfigUpdated(); }; - }, [dispatch, navigate, pathname, queryClient]); + }, [dispatch, navigate, queryClient]); return null; }