mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 23:49:27 +08:00
fix: append search parameters to navigation paths for legacy route compatibility
This commit is contained in:
parent
c68366eff6
commit
ffcb223060
@ -11,7 +11,7 @@ import { EllipsisOutlined } from '@ant-design/icons';
|
|||||||
import ProLayout, { RouteContext, RouteContextType } from '@ant-design/pro-layout';
|
import ProLayout, { RouteContext, RouteContextType } from '@ant-design/pro-layout';
|
||||||
import { HeaderViewProps } from '@ant-design/pro-layout/es/components/Header';
|
import { HeaderViewProps } from '@ant-design/pro-layout/es/components/Header';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { ConfigProvider, Popover, Tooltip } from 'antd';
|
import { Popover, Tooltip } from 'antd';
|
||||||
import React, { createContext, FC, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
import React, { createContext, FC, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { Link, Navigate, Outlet, useLocation } from 'react-router-dom';
|
import { Link, Navigate, Outlet, useLocation } from 'react-router-dom';
|
||||||
@ -29,13 +29,12 @@ import {
|
|||||||
RemoteSchemaTemplateManagerProvider,
|
RemoteSchemaTemplateManagerProvider,
|
||||||
SortableItem,
|
SortableItem,
|
||||||
useDesignable,
|
useDesignable,
|
||||||
useGlobalTheme,
|
|
||||||
useMenuDragEnd,
|
useMenuDragEnd,
|
||||||
useParseURLAndParams,
|
useParseURLAndParams,
|
||||||
useRequest,
|
useRequest,
|
||||||
useSchemaInitializerRender,
|
useSchemaInitializerRender,
|
||||||
useSystemSettings,
|
useSystemSettings,
|
||||||
useToken,
|
useToken
|
||||||
} from '../../../';
|
} from '../../../';
|
||||||
import {
|
import {
|
||||||
CurrentPageUidProvider,
|
CurrentPageUidProvider,
|
||||||
@ -72,7 +71,7 @@ const AllAccessDesktopRoutesContext = createContext<{
|
|||||||
refresh: () => void;
|
refresh: () => void;
|
||||||
}>({
|
}>({
|
||||||
allAccessRoutes: emptyArray,
|
allAccessRoutes: emptyArray,
|
||||||
refresh: () => {},
|
refresh: () => { },
|
||||||
});
|
});
|
||||||
AllAccessDesktopRoutesContext.displayName = 'AllAccessDesktopRoutesContext';
|
AllAccessDesktopRoutesContext.displayName = 'AllAccessDesktopRoutesContext';
|
||||||
|
|
||||||
@ -636,7 +635,7 @@ const LegacyRouteCompat: FC = (props) => {
|
|||||||
const location = useLocationNoUpdate();
|
const location = useLocationNoUpdate();
|
||||||
|
|
||||||
if (route) {
|
if (route) {
|
||||||
return <Navigate to={location.pathname.replace(currentPageUid, route.schemaUid)} />;
|
return <Navigate to={location.pathname.replace(currentPageUid, route.schemaUid) + location.search} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <>{props.children}</>;
|
return <>{props.children}</>;
|
||||||
|
@ -215,7 +215,7 @@ const InternalPageContent = (props: PageContentProps) => {
|
|||||||
// 兼容旧版本的 tab 路径
|
// 兼容旧版本的 tab 路径
|
||||||
const oldTab = currentRoute?.children?.find((tabRoute) => tabRoute.tabSchemaName === activeKey);
|
const oldTab = currentRoute?.children?.find((tabRoute) => tabRoute.tabSchemaName === activeKey);
|
||||||
if (oldTab) {
|
if (oldTab) {
|
||||||
navigate(location.pathname.replace(activeKey, oldTab.schemaUid));
|
navigate(location.pathname.replace(activeKey, oldTab.schemaUid) + location.search);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user