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 }>`
background-color: ${({ theme, isLoading }) => isLoading && theme.secondary};
border-radius: 0.25em;
padding: 0.375em 0;
width: 1.5em;
`
function TokenOption({ index, value, style }: TokenOptionProps) {
......
......@@ -25,7 +25,8 @@ function useBlock() {
useEffect(() => {
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
.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