Skip to content

Commit

Permalink
Fix import token popup issue (#536)
Browse files Browse the repository at this point in the history
* Comment out Sentry deployment

* Fix for import token popup

* Revert "Comment out Sentry deployment"

This reverts commit 1b96bd7.
  • Loading branch information
nenadV91 authored May 6, 2022
1 parent 8926a13 commit 4e54c10
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/custom/pages/Swap/SwapMod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ export default function Swap({

// dismiss warning if all imported tokens are in active lists
const defaultTokens = useAllTokens()
const importTokensNotInDefault = useMemo(
() =>
const importTokensNotInDefault = useMemo(() => {
// We should return an empty array until the defaultTokens are loaded
// Otherwise WETH will be in urlLoadedTokens but defaultTokens will be empty
// Fix for https://github.com/cowprotocol/cowswap/issues/534
if (!Object.keys(defaultTokens).length) return []
return (
urlLoadedTokens &&
urlLoadedTokens
.filter((token: Token) => {
Expand All @@ -144,9 +148,9 @@ export default function Swap({
const shorthandTokenAddress = TOKEN_SHORTHANDS[shorthand][supported]
return shorthandTokenAddress && shorthandTokenAddress === token.address
})
}),
[chainId, defaultTokens, urlLoadedTokens]
)
})
)
}, [chainId, defaultTokens, urlLoadedTokens])

const theme = useContext(ThemeContext)

Expand Down

0 comments on commit 4e54c10

Please sign in to comment.