Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoYhun committed Jul 27, 2023
1 parent b45004b commit a8fd82a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ const PERSISTED_KEYS: string[] = ['user', 'transactions', 'profile']
ENV_LEVEL < ENV_TYPE.PROD && PERSISTED_KEYS.push('customizeDexes')

// Migrate from old version to new version, prevent lost favorite tokens of user
const storedState: any = load({ states: PERSISTED_KEYS })
if ('user' in storedState) {
const userState: UserState = storedState.user
const preloadedState: any = load({ states: PERSISTED_KEYS })
if ('user' in preloadedState) {
const userState: UserState = preloadedState.user
if (userState.favoriteTokensByChainId) {
userState.favoriteTokensByChainIdv2 = Object.entries(userState.favoriteTokensByChainId).reduce(
(acc, [chainId, obj]) => {
Expand Down Expand Up @@ -123,7 +123,7 @@ const store = configureStore({
.concat(routeApi.middleware)
.concat(socialApi.middleware)
.concat(tokenApi.middleware),
preloadedState: storedState,
preloadedState,
})

const PREFIX_REDUX_PERSIST = 'redux_localstorage_simple_'
Expand Down
2 changes: 1 addition & 1 deletion src/state/user/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export const useUserFavoriteTokens = (chainId: ChainId) => {
const { favoriteTokensByChainIdv2: favoriteTokensByChainId } = useSelector((state: AppState) => state.user)
const { commonTokens } = useKyberSwapConfig(chainId)
const defaultTokens = useMemo(() => {
return commonTokens || SUGGESTED_BASES[chainId || 1].map(e => e.address)
return commonTokens || SUGGESTED_BASES[chainId || ChainId.MAINNET].map(e => e.address)
}, [commonTokens, chainId])

const favoriteTokens = useMemo(() => {
Expand Down

0 comments on commit a8fd82a

Please sign in to comment.