Hot fix for token error parsing (#1382)

* hot fix for token list parsing

* revert tsconfig
This commit is contained in:
Ian Lapham 2021-05-03 12:11:27 -04:00 committed by GitHub
parent d425ff64b4
commit 6d5625a1f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

@ -103,10 +103,8 @@ function combineMaps(map1: TokenAddressMap, map2: TokenAddressMap): TokenAddress
// merge tokens contained within lists from urls // merge tokens contained within lists from urls
function useCombinedTokenMapFromUrls(urls: string[] | undefined): TokenAddressMap { function useCombinedTokenMapFromUrls(urls: string[] | undefined): TokenAddressMap {
const lists = useAllLists() const lists = useAllLists()
return useMemo(() => { return useMemo(() => {
if (!urls) return EMPTY_LIST if (!urls) return EMPTY_LIST
return ( return (
urls urls
.slice() .slice()

@ -7,7 +7,7 @@ import { useFetchListCallback } from '../../hooks/useFetchListCallback'
import useInterval from '../../hooks/useInterval' import useInterval from '../../hooks/useInterval'
import useIsWindowVisible from '../../hooks/useIsWindowVisible' import useIsWindowVisible from '../../hooks/useIsWindowVisible'
import { AppDispatch } from '../index' import { AppDispatch } from '../index'
import { acceptListUpdate } from './actions' import { acceptListUpdate, removeList } from './actions'
import { useActiveListUrls } from './hooks' import { useActiveListUrls } from './hooks'
import { useAllInactiveTokens } from 'hooks/Tokens' import { useAllInactiveTokens } from 'hooks/Tokens'
import { UNSUPPORTED_LIST_URLS } from 'constants/lists' import { UNSUPPORTED_LIST_URLS } from 'constants/lists'
@ -35,6 +35,13 @@ export default function Updater(): null {
// fetch all lists every 10 minutes, but only after we initialize library // fetch all lists every 10 minutes, but only after we initialize library
useInterval(fetchAllListsCallback, library ? 1000 * 60 * 10 : null) useInterval(fetchAllListsCallback, library ? 1000 * 60 * 10 : null)
// hot fix for fetching error
useEffect(() => {
if (lists['https://tokens.coingecko.com/uniswap/all.json']) {
dispatch(removeList('https://tokens.coingecko.com/uniswap/all.json'))
}
}, [dispatch, lists])
// whenever a list is not loaded and not loading, try again to load it // whenever a list is not loaded and not loading, try again to load it
useEffect(() => { useEffect(() => {
Object.keys(lists).forEach(listUrl => { Object.keys(lists).forEach(listUrl => {