This repository was archived by the owner on Aug 12, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +2
-19
lines changed
packages/console-utils/xconsole-context/src/region Expand file tree Collapse file tree 1 file changed +2
-19
lines changed Original file line number Diff line number Diff line change 1- // @ts -ignore
2- import Cookie from 'js-cookie' ;
3-
41import isArray from 'lodash/isArray' ;
52import { IPayloadRegion } from 'src/types/ConsoleBase' ;
6-
7- // 默认标识
8- const DEFAULT_COOKIE_KEY = 'activeRegionId' ;
9- const CURRENT_DEFAULT_COOKIE_KEY = 'currentRegionId' ;
10-
11- const getRegionFromCookie = ( key = '' ) : string => {
12- if ( key === '' ) {
13- return (
14- Cookie . get ( CURRENT_DEFAULT_COOKIE_KEY ) ||
15- Cookie . get ( DEFAULT_COOKIE_KEY ) ||
16- 'cn-hangzhou'
17- ) ;
18- }
19- return Cookie . get ( key ) ;
20- } ;
3+ import { getActiveId } from './cookies' ;
214
225const getIdFromItem = ( item : IPayloadRegion ) : string => {
236 return item . id
@@ -33,7 +16,7 @@ export const determineRegionId = (
3316 // 没有调用者从 context 中获取失败, 或调用者明确不为该参数赋值,
3417 // 则使用 getActiveId 从 cookie 中取值进行兜底, 尽量让该值保持一个有效的状态.
3518 // 只有在用户第一次访问控制台时, 该值可能为空
36- const exactCurrentActiveId = currentActiveId || getRegionFromCookie ( ) ;
19+ const exactCurrentActiveId = currentActiveId || getActiveId ( ) ;
3720
3821 // 对 dataSource 进行预处理, 如果不符合期望, 则直接返回当前的 activeId
3922 // 之所以没有返回用户声明的 id, 是因为用户的输入无法进行预测,
You can’t perform that action at this time.
0 commit comments