fix: keep alive

This commit is contained in:
Zeke Zhang 2025-02-28 07:34:19 +08:00
parent bea0a2c524
commit 4fe9a10632
2 changed files with 13 additions and 11 deletions

View File

@ -136,7 +136,15 @@ export const AdminDynamicPage = () => {
return <AppNotFound />; return <AppNotFound />;
} }
return <KeepAlive uid={currentPageUid}>{(uid) => <RemoteSchemaComponent uid={uid} />}</KeepAlive>; return (
<KeepAlive uid={currentPageUid}>
{(uid) => (
<CurrentRouteProvider uid={uid}>
<RemoteSchemaComponent uid={uid} />
</CurrentRouteProvider>
)}
</KeepAlive>
);
}; };
const layoutContentClass = css` const layoutContentClass = css`
@ -212,17 +220,13 @@ const pageContentStyle: React.CSSProperties = {
}; };
export const LayoutContent = () => { export const LayoutContent = () => {
const currentPageUid = useCurrentPageUid();
/* Use the "nb-subpages-slot-without-header-and-side" class name to locate the position of the subpages */ /* Use the "nb-subpages-slot-without-header-and-side" class name to locate the position of the subpages */
return ( return (
<CurrentRouteProvider uid={currentPageUid}>
<div className={`${layoutContentClass} nb-subpages-slot-without-header-and-side`}> <div className={`${layoutContentClass} nb-subpages-slot-without-header-and-side`}>
<div style={pageContentStyle}> <div style={pageContentStyle}>
<Outlet /> <Outlet />
</div> </div>
</div> </div>
</CurrentRouteProvider>
); );
}; };

View File

@ -25,7 +25,6 @@ import {
CurrentTabUidContext, CurrentTabUidContext,
useCurrentSearchParams, useCurrentSearchParams,
useCurrentTabUid, useCurrentTabUid,
useLocationNoUpdate,
useNavigateNoUpdate, useNavigateNoUpdate,
useRouterBasename, useRouterBasename,
} from '../../../application/CustomRouterContextProvider'; } from '../../../application/CustomRouterContextProvider';
@ -202,7 +201,6 @@ interface PageContentProps {
const InternalPageContent = (props: PageContentProps) => { const InternalPageContent = (props: PageContentProps) => {
const { loading, disablePageHeader, enablePageTabs, activeKey } = props; const { loading, disablePageHeader, enablePageTabs, activeKey } = props;
const currentRoute = useCurrentRouteData(); const currentRoute = useCurrentRouteData();
const location = useLocationNoUpdate();
const navigate = useNavigateNoUpdate(); const navigate = useNavigateNoUpdate();
const children = currentRoute?.children || []; const children = currentRoute?.children || [];