From dd195d5aa8a1a56bbf2be1f0f63b7d5348f8c6dd Mon Sep 17 00:00:00 2001 From: jiaxiang Date: Wed, 4 Jun 2025 09:59:52 +0800 Subject: [PATCH 1/2] chore: remove deprecated deps (#11423) --- package.json | 3 --- src/components/RightContent/AvatarDropdown.tsx | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 88424cc5..5fa05c47 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ "antd-style": "^3.7.0", "classnames": "^2.5.1", "dayjs": "^1.11.13", - "querystring": "^0.2.1", "react": "^18.3.1", "react-dom": "^18.3.1" }, @@ -55,9 +54,7 @@ "@commitlint/config-conventional": "^19.5.0", "@testing-library/dom": "^10.4.0", "@testing-library/react": "^16.0.1", - "@types/classnames": "^2.3.1", "@types/express": "^4.17.21", - "@types/history": "^5.0.0", "@types/jest": "^29.5.13", "@types/lodash": "^4.17.10", "@types/react": "^18.3.11", diff --git a/src/components/RightContent/AvatarDropdown.tsx b/src/components/RightContent/AvatarDropdown.tsx index fe30b2f9..3166d5c7 100644 --- a/src/components/RightContent/AvatarDropdown.tsx +++ b/src/components/RightContent/AvatarDropdown.tsx @@ -4,7 +4,6 @@ import { history, useModel } from '@umijs/max'; import { Spin } from 'antd'; import type { MenuProps } from 'antd'; import { createStyles } from 'antd-style'; -import { stringify } from 'querystring'; import React from 'react'; import { flushSync } from 'react-dom'; import HeaderDropdown from '../HeaderDropdown'; @@ -46,15 +45,16 @@ export const AvatarDropdown: React.FC = ({ menu, childre await outLogin(); const { search, pathname } = window.location; const urlParams = new URL(window.location.href).searchParams; + const searchParams = new URLSearchParams({ + redirect: pathname + search, + }); /** 此方法会跳转到 redirect 参数所在的位置 */ const redirect = urlParams.get('redirect'); // Note: There may be security issues, please note if (window.location.pathname !== '/user/login' && !redirect) { history.replace({ pathname: '/user/login', - search: stringify({ - redirect: pathname + search, - }), + search: searchParams.toString(), }); } }; From da2e0fadaca61bc971e76edd9ae8c98056c9f0be Mon Sep 17 00:00:00 2001 From: wudi Date: Wed, 4 Jun 2025 10:00:10 +0800 Subject: [PATCH 2/2] refactor(app): Update the comments for the getInitialState function (#11408) --- src/app.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.tsx b/src/app.tsx index 679b0c5f..1f6a3cf9 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -13,7 +13,7 @@ const isDev = process.env.NODE_ENV === 'development'; const loginPath = '/user/login'; /** - * @see https://umijs.org/zh-CN/plugins/plugin-initial-state + * @see https://umijs.org/docs/api/runtime-config#getinitialstate * */ export async function getInitialState(): Promise<{ settings?: Partial;