Skip to content

Commit

Permalink
refactor: opt for useCacheToken cal perf
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Feb 18, 2022
1 parent 62617e3 commit 0dba1d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/useCacheToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ export default function useCacheToken(
const { salt = '' } = option;

// Basic
const tokenStr = flattenToken(Object.assign({}, ...tokens));
const mergedToken = Object.assign({}, ...tokens);
const tokenStr = flattenToken(mergedToken);

const cachedToken = useGlobalCache(
'token',
[salt, tokenStr],
() => {
const mergedDesignToken = Object.assign({}, ...tokens);
const derivativeToken = theme.getDerivativeToken(mergedDesignToken);
const derivativeToken = theme.getDerivativeToken(mergedToken);

// Optimize for `useStyleRegister` performance
const tokenKey = token2key(derivativeToken, salt);
Expand Down

0 comments on commit 0dba1d3

Please sign in to comment.