Merge pull request #4601 from blockscout/vb-fix-endless-fetching-tokens

Fix endless Fetching tokens... message on empty addresses
pull/4602/head
Victor Baranov 3 years ago committed by GitHub
commit 2023b2b2b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 6
      apps/block_scout_web/assets/js/pages/address.js
  3. 7
      apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex

@ -6,6 +6,7 @@
- [#4579](https://github.com/blockscout/blockscout/pull/4579) - Write contract page: Resize inputs; Improve multiplier selector
### Fixes
- [#4601](https://github.com/blockscout/blockscout/pull/4601) - Fix endless Fetching tokens... message on empty addresses
- [#4591](https://github.com/blockscout/blockscout/pull/4591) - Add step and min value for txValue input field
- [#4589](https://github.com/blockscout/blockscout/pull/4589) - Fix solid outputs on contract read page
- [#4586](https://github.com/blockscout/blockscout/pull/4586) - Fix floating tooltips on the token transfer family blocks

@ -77,9 +77,11 @@ export function reducer (state = initialState, action) {
let fetchedTokenBalanceBlockNumber = 0
function loadTokenBalance (blockNumber) {
if (blockNumber >= fetchedTokenBalanceBlockNumber) {
if (blockNumber > fetchedTokenBalanceBlockNumber) {
fetchedTokenBalanceBlockNumber = blockNumber
setTimeout(loadTokenBalanceDropdown, 1000)
} else if (fetchedTokenBalanceBlockNumber === 0 && blockNumber === null) {
setTimeout(loadTokenBalanceDropdown, 1000)
}
}
@ -94,7 +96,7 @@ const elements = {
return { balanceCard: $el.html(), balance: parseFloat($el.find('.current-balance-in-wei').attr('data-wei-value')) }
},
render ($el, state, oldState) {
if (oldState.balance === state.balance || isNaN(state.balance)) return
if (oldState.balance === state.balance || (isNaN(oldState.balance) && isNaN(state.balance))) return
$el.empty().append(state.balanceCard)
loadTokenBalance(state.fetchedCoinBalanceBlockNumber)
updateAllCalculatedUsdValues()

@ -92,7 +92,12 @@ defmodule BlockScoutWeb.AddressController do
validation_count: validation_count
})
else
_ -> not_found(conn)
_ ->
json(conn, %{
transaction_count: 0,
gas_usage_count: 0,
validation_count: 0
})
end
end

Loading…
Cancel
Save