From 5f6a68d844a75e44d0130193e770c2c276d8e256 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 18 Sep 2025 18:44:21 +0700 Subject: [PATCH] fix: avoid the entire app layout re render on route change --- web-app/src/routes/__root.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/web-app/src/routes/__root.tsx b/web-app/src/routes/__root.tsx index ca287872b..cfa05df16 100644 --- a/web-app/src/routes/__root.tsx +++ b/web-app/src/routes/__root.tsx @@ -192,17 +192,16 @@ const LogsLayout = () => { } function RootLayout() { - const pathname = useRouterState({ - select: (state) => state.location.pathname, - }) - const isLocalAPIServerLogsRoute = useMemo( - () => + const getInitialLayoutType = () => { + const pathname = window.location.pathname + return ( pathname === route.localApiServerlogs || pathname === route.systemMonitor || - pathname === route.appLogs, - [pathname] - ) + pathname === route.appLogs + ) + } + const IS_LOGS_ROUTE = getInitialLayoutType() return ( @@ -214,7 +213,7 @@ function RootLayout() { - {isLocalAPIServerLogsRoute ? : } + {IS_LOGS_ROUTE ? : } {/* {isLocalAPIServerLogsRoute ? : } */}