Commit 372beb53e3ad6b8facaa5a27b95b964bb7c16ab9

Authored by ww
1 parent 7a32d197

fix: fix clear persist storage bug

@@ -38,7 +38,7 @@ export function transformMenuModule(menuModule: MenuModule): Menu { @@ -38,7 +38,7 @@ export function transformMenuModule(menuModule: MenuModule): Menu {
38 } 38 }
39 39
40 export function transformRouteToMenu(routeModList: AppRouteModule[], routerMapping = false) { 40 export function transformRouteToMenu(routeModList: AppRouteModule[], routerMapping = false) {
41 - const cloneRouteModList = cloneDeep(routeModList); 41 + const cloneRouteModList = cloneDeep(routeModList) ?? [];
42 const routeList: AppRouteRecordRaw[] = []; 42 const routeList: AppRouteRecordRaw[] = [];
43 43
44 cloneRouteModList.forEach((item) => { 44 cloneRouteModList.forEach((item) => {
@@ -115,6 +115,7 @@ window.addEventListener('beforeunload', function () { @@ -115,6 +115,7 @@ window.addEventListener('beforeunload', function () {
115 REFRESH_TOKEN_KEY, 115 REFRESH_TOKEN_KEY,
116 USER_INFO_KEY, 116 USER_INFO_KEY,
117 LOCK_INFO_KEY, 117 LOCK_INFO_KEY,
  118 + ROLES_KEY,
118 ]), 119 ]),
119 }); 120 });
120 ss.set(APP_SESSION_CACHE_KEY, { 121 ss.set(APP_SESSION_CACHE_KEY, {
@@ -125,6 +126,7 @@ window.addEventListener('beforeunload', function () { @@ -125,6 +126,7 @@ window.addEventListener('beforeunload', function () {
125 REFRESH_TOKEN_KEY, 126 REFRESH_TOKEN_KEY,
126 USER_INFO_KEY, 127 USER_INFO_KEY,
127 LOCK_INFO_KEY, 128 LOCK_INFO_KEY,
  129 + ROLES_KEY,
128 ]), 130 ]),
129 }); 131 });
130 }); 132 });
@@ -128,7 +128,7 @@ export function filter<T = any>( @@ -128,7 +128,7 @@ export function filter<T = any>(
128 config = getConfig(config); 128 config = getConfig(config);
129 const children = config.children as string; 129 const children = config.children as string;
130 function listFilter(list: T[]) { 130 function listFilter(list: T[]) {
131 - return list 131 + return (list ?? [])
132 .map((node: any) => ({ ...node })) 132 .map((node: any) => ({ ...node }))
133 .filter((node) => { 133 .filter((node) => {
134 node[children] = node[children] && listFilter(node[children]); 134 node[children] = node[children] && listFilter(node[children]);