Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 2234ec7

Browse files
committed
fix: get correct matchPath before sendPV
1 parent 531c578 commit 2234ec7

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/console-utils/xconsole-context/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alicloud/xconsole-context",
3-
"version": "2.4.35",
3+
"version": "2.4.36",
44
"main": "lib/index.js",
55
"module": "es/index.js",
66
"types": "lib/index.d.ts",

packages/console-utils/xconsole-context/src/withConsoleContext.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function withAsyncRegionList<P extends IConsoleContextProp, S = {}>(
7676
const { region: { regionList: userRegionListConfig } = {}, location, match, history, appConfig } = props;
7777
const [loading, setLoading] = useState(isFunction(userRegionListConfig));
7878
const [regionList, setRegionList] = useState(isFunction(userRegionListConfig) ? [] : userRegionListConfig as IPayloadRegion[]);
79-
const lastMatchUrl = useRef('');
79+
const lastPathname = useRef('');
8080

8181
const { customPaths = [] } = appConfig?.aplus || {};
8282

@@ -95,13 +95,11 @@ function withAsyncRegionList<P extends IConsoleContextProp, S = {}>(
9595
useEffect(() => {
9696
const aplusConfig = (window as unknown as IWin).APLUS_CONFIG || {};
9797

98-
if (lastMatchUrl.current === history.location.pathname) return;
99-
lastMatchUrl.current = history.location.pathname;
98+
if (lastPathname.current === history.location.pathname) return;
99+
lastPathname.current = history.location.pathname;
100100

101101
const { spmbPrefix } = aplusConfig;
102102

103-
const matchPath = match.isExact ? match.path : matchCustomPath(customPaths, history.location.pathname) || match.path;
104-
105103
if (spmbPrefix) {
106104
// @ts-ignore
107105
// eslint-disable-next-line @typescript-eslint/camelcase
@@ -110,6 +108,7 @@ function withAsyncRegionList<P extends IConsoleContextProp, S = {}>(
110108
// 由于 aplus 不是实时发送,存在时延,故需要特殊处理重定向场景
111109
((url) => {
112110
setTimeout(() => {
111+
const matchPath = matchCustomPath(customPaths, history.location.pathname) || match.path;
113112
// url 不等,说明发生了重定向或者用户快速的跳转
114113
if (url === window.location.href) {
115114
// 延迟发送

0 commit comments

Comments
 (0)