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

View File

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