Commit 92e61fa3 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

fix: token balance reloading (#3408)

* fix: layout token balance on token select

* fix: do not clear block on window re-focus
parent ef62fd33
...@@ -73,7 +73,6 @@ const TokenBalance = styled.div<{ isLoading: boolean }>` ...@@ -73,7 +73,6 @@ const TokenBalance = styled.div<{ isLoading: boolean }>`
background-color: ${({ theme, isLoading }) => isLoading && theme.secondary}; background-color: ${({ theme, isLoading }) => isLoading && theme.secondary};
border-radius: 0.25em; border-radius: 0.25em;
padding: 0.375em 0; padding: 0.375em 0;
width: 1.5em;
` `
function TokenOption({ index, value, style }: TokenOptionProps) { function TokenOption({ index, value, style }: TokenOptionProps) {
......
...@@ -25,7 +25,8 @@ function useBlock() { ...@@ -25,7 +25,8 @@ function useBlock() {
useEffect(() => { useEffect(() => {
if (library && chainId && windowVisible) { if (library && chainId && windowVisible) {
setState({ chainId }) // If chainId hasn't changed, don't clear the block. This prevents re-fetching still valid data.
setState((state) => (state.chainId === chainId ? state : { chainId }))
library library
.getBlockNumber() .getBlockNumber()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment