Skip to content

Commit

Permalink
chore: add default override as cache
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Mar 21, 2022
1 parent ac24a4f commit 2201bf6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/useCacheToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type Theme from './Theme';
import useGlobalCache from './useGlobalCache';
import { flattenToken, token2key } from './util';

const EMPTY_OVERRIDE = {};

export interface Option {
/**
* Generate token with salt.
Expand Down Expand Up @@ -63,7 +65,7 @@ export default function useCacheToken<
tokens: Partial<DesignToken>[],
option: Option = {},
): [DerivativeToken & { _tokenKey: string }, string] {
const { salt = '', override = {} } = option;
const { salt = '', override = EMPTY_OVERRIDE } = option;

// Basic - We do basic cache here
const mergedToken = React.useMemo(
Expand Down

0 comments on commit 2201bf6

Please sign in to comment.