Skip to content

Commit

Permalink
fix: maximum call stack size (vbenjs#4674)
Browse files Browse the repository at this point in the history
* fix: maximum call stack size
  • Loading branch information
vince292007 authored and GavinLucky committed Oct 23, 2024
1 parent bd234ec commit bcdcf80
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 197 deletions.
1 change: 0 additions & 1 deletion packages/@core/base/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
"dependencies": {
"@ctrl/tinycolor": "catalog:",
"@tanstack/vue-store": "catalog:",
"@vue/reactivity": "catalog:",
"@vue/shared": "catalog:",
"clsx": "catalog:",
"defu": "catalog:",
Expand Down
1 change: 0 additions & 1 deletion packages/@core/base/shared/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export * from './inference';
export * from './letter';
export * from './merge';
export * from './nprogress';
export * from './reactivity';
export * from './state-handler';
export * from './to';
export * from './tree';
Expand Down
26 changes: 0 additions & 26 deletions packages/@core/base/shared/src/utils/reactivity.ts

This file was deleted.

27 changes: 14 additions & 13 deletions packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { computed, ref } from 'vue';
import { Pin, X } from '@vben-core/icons';
import { VbenContextMenu, VbenIcon } from '@vben-core/shadcn-ui';
import { deepToRaw } from '@vben-core/shared/utils';
interface Props extends TabsProps {}
Expand Down Expand Up @@ -40,19 +39,21 @@ const style = computed(() => {
};
});
const tabsView = computed((): TabConfig[] => {
return props.tabs.map((_tab) => {
const tab = deepToRaw(_tab);
const tabsView = computed(() => {
return props.tabs.map((tab) => {
const { fullPath, meta, name, path } = tab || {};
const { affixTab, icon, newTabTitle, tabClosable, title } = meta || {};
return {
...tab,
affixTab: !!tab.meta?.affixTab,
closable: Reflect.has(tab.meta, 'tabClosable')
? !!tab.meta.tabClosable
: true,
icon: tab.meta.icon as string,
key: tab.fullPath || tab.path,
title: (tab.meta?.newTabTitle || tab.meta?.title || tab.name) as string,
};
affixTab: !!affixTab,
closable: Reflect.has(meta, 'tabClosable') ? !!tabClosable : true,
fullPath,
icon: icon as string,
key: fullPath || path,
meta,
name,
path,
title: (newTabTitle || title || name) as string,
} as TabConfig;
});
});
</script>
Expand Down
27 changes: 14 additions & 13 deletions packages/@core/ui-kit/tabs-ui/src/components/tabs/tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { computed } from 'vue';
import { Pin, X } from '@vben-core/icons';
import { VbenContextMenu, VbenIcon } from '@vben-core/shadcn-ui';
import { deepToRaw } from '@vben-core/shared/utils';
interface Props extends TabsProps {}
Expand Down Expand Up @@ -46,19 +45,21 @@ const typeWithClass = computed(() => {
return typeClasses[props.styleType || 'plain'] || { content: '' };
});
const tabsView = computed((): TabConfig[] => {
return props.tabs.map((_tab) => {
const tab = deepToRaw(_tab);
const tabsView = computed(() => {
return props.tabs.map((tab) => {
const { fullPath, meta, name, path } = tab || {};
const { affixTab, icon, newTabTitle, tabClosable, title } = meta || {};
return {
...tab,
affixTab: !!tab.meta?.affixTab,
closable: Reflect.has(tab.meta, 'tabClosable')
? !!tab.meta.tabClosable
: true,
icon: tab.meta.icon as string,
key: tab.fullPath || tab.path,
title: (tab.meta?.newTabTitle || tab.meta?.title || tab.name) as string,
};
affixTab: !!affixTab,
closable: Reflect.has(meta, 'tabClosable') ? !!tabClosable : true,
fullPath,
icon: icon as string,
key: fullPath || path,
meta,
name,
path,
title: (newTabTitle || title || name) as string,
} as TabConfig;
});
});
</script>
Expand Down
4 changes: 2 additions & 2 deletions packages/effects/layouts/src/basic/layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
usePreferences,
} from '@vben/preferences';
import { useLockStore } from '@vben/stores';
import { deepToRaw, mapTree } from '@vben/utils';
import { cloneDeep, mapTree } from '@vben/utils';
import { VbenAdminLayout } from '@vben-core/layout-ui';
import { VbenBackTop, VbenLogo } from '@vben-core/shadcn-ui';
Expand Down Expand Up @@ -112,7 +112,7 @@ const {
function wrapperMenus(menus: MenuRecordRaw[]) {
return mapTree(menus, (item) => {
return { ...deepToRaw(item), name: $t(item.name) };
return { ...cloneDeep(item), name: $t(item.name) };
});
}
Expand Down
Loading

0 comments on commit bcdcf80

Please sign in to comment.