Skip to content

Commit 80e6565

Browse files
committed
feat(theme): more performance improvements
1 parent a295b9d commit 80e6565

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/ui/src/helpers/resolve-theme.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export function resolveTheme<T>(
6262
applyThemeList?: DeepPartialApplyTheme<T>[],
6363
): T {
6464
const prefix = getPrefix();
65+
const _custom = custom?.filter((value) => value !== undefined);
6566
const _clearThemeList = clearThemeList?.filter((value) => value !== undefined);
6667
const _applyThemeList = applyThemeList?.filter((value) => value !== undefined);
6768
const baseTheme = _clearThemeList?.length || prefix ? klona(base) : base;
@@ -88,9 +89,13 @@ export function resolveTheme<T>(
8889
stringIterator(baseTheme, (value) => applyPrefix(value, prefix));
8990
}
9091

91-
const theme = deepMergeStrings(twMerge)(baseTheme, ...custom) as T;
92+
let theme = baseTheme;
9293

93-
if (_applyThemeList?.length) {
94+
if (_custom.length) {
95+
theme = deepMergeStrings(twMerge)(baseTheme, ...custom) as T;
96+
}
97+
98+
if (_applyThemeList?.length && _custom.length) {
9499
const finalApplyTheme = cloneWithValue<T, ApplyTheme>(baseTheme, "merge");
95100

96101
let run = false;

0 commit comments

Comments
 (0)