From 1dd0b10cbcb0c01d84f2bd278abffd7b39c5ceae Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 13 Oct 2025 14:23:47 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=89=8D=E7=AB=AF=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=B8=85=E9=99=A4=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core-frontend/src/config/axios/service.ts | 7 ++++--- core/core-frontend/src/utils/cacheUtil.ts | 21 +++++++++++++++++++ de-xpack | 2 +- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 core/core-frontend/src/utils/cacheUtil.ts diff --git a/core/core-frontend/src/config/axios/service.ts b/core/core-frontend/src/config/axios/service.ts index 72b8a7a7af..7f2a86f964 100644 --- a/core/core-frontend/src/config/axios/service.ts +++ b/core/core-frontend/src/config/axios/service.ts @@ -16,6 +16,8 @@ import { config } from './config' import { configHandler } from './refresh' import { isMobile, getLocale } from '@/utils/utils' import { useRequestStoreWithOut } from '@/store/modules/request' +import { clearCache } from '@/utils/cacheUtil' + type AxiosErrorWidthLoading = T & { config: { loading?: boolean @@ -189,7 +191,7 @@ service.interceptors.response.use( showClose: true }) if (response.data.code === 80001) { - localStorage.clear() + clearCache() let queryRedirectPath = '/workbranch/index' if (router.currentRoute.value.fullPath) { queryRedirectPath = router.currentRoute.value.fullPath as string @@ -246,7 +248,7 @@ service.interceptors.response.use( error.config.loading && tryHideLoading(permissionStore.getCurrentPath) if (header.has('DE-GATEWAY-FLAG')) { - localStorage.clear() + clearCache() const flag = header.get('DE-GATEWAY-FLAG') localStorage.setItem('DE-GATEWAY-FLAG', flag.toString()) let queryRedirectPath = '/workbranch/index' @@ -295,7 +297,6 @@ const executeVersionHandler = (response: AxiosResponse) => { return } if (executeVersion && executeVersion !== cacheVal) { - wsCache.clear() wsCache.set(key, executeVersion) showMsg('系统有升级,请点击刷新页面', '-sys-upgrade-') } diff --git a/core/core-frontend/src/utils/cacheUtil.ts b/core/core-frontend/src/utils/cacheUtil.ts new file mode 100644 index 0000000000..f37de37b6a --- /dev/null +++ b/core/core-frontend/src/utils/cacheUtil.ts @@ -0,0 +1,21 @@ +export const clearCache = () => { + const keys = [ + 'DataEaseKey', + 'TreeSort-backend', + 'app.desktop', + 'de-global-refresh', + 'open-backend', + 'panel-weight', + 'screen-weight', + 'user.exp', + 'user.language', + 'user.name', + 'user.oid', + 'user.time', + 'user.token', + 'user.uid' + ] + keys.forEach(key => { + localStorage.removeItem(key) + }) +} diff --git a/de-xpack b/de-xpack index 2cbba8ae77..edf9ca0ee6 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit 2cbba8ae771ee4df60ac910ee23b50ed3916c655 +Subproject commit edf9ca0ee6d9efb407257071474ac0de63819eb2