Skip to content

Commit

Permalink
A smol bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KaffinPX committed Sep 16, 2024
1 parent 14efa0d commit 67362cc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/contexts/Indexer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export function IndexerProvider ({ children }: {
}, [ networkId ])

const refresh = useCallback(async () => {
if (indexer.url === '') return setTokens({})

let tokens: Token[] = []
let cursor = undefined

Expand All @@ -40,15 +42,14 @@ export function IndexerProvider ({ children }: {
if (response.result.length < 50) break
cursor = response.next
}

setTokens(tokens.reduce((acc: {[ ticker: string ]: Token}, token) => {
acc[token.tick] = token
return acc
}, {}))
}, [ indexer ])

useEffect(() => {
setTokens({})
refresh()
}, [ indexer, refresh ])

Expand Down

0 comments on commit 67362cc

Please sign in to comment.