Make sure to load token balances when account balance is updated

pull/615/head
jimmay5469 6 years ago committed by Stamates
parent 15f566f8b1
commit e55906ce04
  1. 5
      apps/block_scout_web/assets/js/lib/token_balance_dropdown.js
  2. 6
      apps/block_scout_web/assets/js/pages/address.js

@ -16,4 +16,7 @@ const tokenBalanceDropdown = (element) => {
}) })
} }
$('[data-token-balance-dropdown]').each((_index, element) => tokenBalanceDropdown(element)) export function loadTokenBalanceDropdown () {
$('[data-token-balance-dropdown]').each((_index, element) => tokenBalanceDropdown(element))
}
loadTokenBalanceDropdown()

@ -5,6 +5,7 @@ import socket from '../socket'
import router from '../router' import router from '../router'
import { batchChannel, initRedux } from '../utils' import { batchChannel, initRedux } from '../utils'
import { updateAllAges } from '../lib/from_now' import { updateAllAges } from '../lib/from_now'
import { loadTokenBalanceDropdown } from '../lib/token_balance_dropdown'
const BATCH_THRESHOLD = 10 const BATCH_THRESHOLD = 10
@ -133,7 +134,10 @@ router.when('/address/:addressHash').then((params) => initRedux(reducer, {
if ($emptyInternalTransactionsList.length && state.newInternalTransactions.length) window.location.reload() if ($emptyInternalTransactionsList.length && state.newInternalTransactions.length) window.location.reload()
if ($emptyTransactionsList.length && state.newTransactions.length) window.location.reload() if ($emptyTransactionsList.length && state.newTransactions.length) window.location.reload()
if (state.channelDisconnected) $channelDisconnected.show() if (state.channelDisconnected) $channelDisconnected.show()
if (oldState.balance !== state.balance) $balance.empty().append(state.balance) if (oldState.balance !== state.balance) {
$balance.empty().append(state.balance)
loadTokenBalanceDropdown()
}
if (oldState.transactionCount !== state.transactionCount) $transactionCount.empty().append(numeral(state.transactionCount).format()) if (oldState.transactionCount !== state.transactionCount) $transactionCount.empty().append(numeral(state.transactionCount).format())
if (state.batchCountAccumulator) { if (state.batchCountAccumulator) {
$channelBatching.show() $channelBatching.show()

Loading…
Cancel
Save