fix: avoid the entire app layout re render on route change
This commit is contained in:
parent
be83395f69
commit
5f6a68d844
@ -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 (
|
||||
<Fragment>
|
||||
<ServiceHubProvider>
|
||||
@ -214,7 +213,7 @@ function RootLayout() {
|
||||
<AuthProvider>
|
||||
<DataProvider />
|
||||
<GlobalEventHandler />
|
||||
{isLocalAPIServerLogsRoute ? <LogsLayout /> : <AppLayout />}
|
||||
{IS_LOGS_ROUTE ? <LogsLayout /> : <AppLayout />}
|
||||
</AuthProvider>
|
||||
</ExtensionProvider>
|
||||
{/* {isLocalAPIServerLogsRoute ? <LogsLayout /> : <AppLayout />} */}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user