Only load in new transactions on page 1

Co-authored-by: Stamates <stamates@hotmail.com>
pull/333/head
jimmay5469 7 years ago
parent 62dc04a75b
commit a15f357998
  1. 26
      apps/explorer_web/assets/js/pages/address.js
  2. 5
      apps/explorer_web/assets/package-lock.json
  3. 3
      apps/explorer_web/assets/package.json

@ -1,4 +1,5 @@
import $ from 'jquery' import $ from 'jquery'
import URI from 'urijs'
import socket from '../socket' import socket from '../socket'
if (window.page === 'address') { if (window.page === 'address') {
@ -7,17 +8,20 @@ if (window.page === 'address') {
.receive('ok', resp => { console.log('Joined successfully', `addresses:${window.addressHash}`, resp) }) .receive('ok', resp => { console.log('Joined successfully', `addresses:${window.addressHash}`, resp) })
.receive('error', resp => { console.log('Unable to join', `addresses:${window.addressHash}`, resp) }) .receive('error', resp => { console.log('Unable to join', `addresses:${window.addressHash}`, resp) })
const $emptyTransactionsList = $('[data-selector="empty-transactions-list"]') const currentLocation = URI(window.location)
if ($emptyTransactionsList) { if(!currentLocation.hasQuery('block_number')) {
channel.on('transaction', () => { const $emptyTransactionsList = $('[data-selector="empty-transactions-list"]')
window.location.reload() if ($emptyTransactionsList) {
}) channel.on('transaction', () => {
} window.location.reload()
})
}
const $transactionsList = $('[data-selector="transactions-list"]') const $transactionsList = $('[data-selector="transactions-list"]')
if ($transactionsList) { if ($transactionsList) {
channel.on('transaction', (msg) => { channel.on('transaction', (msg) => {
$transactionsList.prepend(msg.transaction) $transactionsList.prepend(msg.transaction)
}) })
}
} }
} }

@ -8164,6 +8164,11 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"urijs": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.1.tgz",
"integrity": "sha512-xVrGVi94ueCJNrBSTjWqjvtgvl3cyOTThp2zaMaFNGp3F542TR6sM3f2o8RqZl+AwteClSVmoCyt0ka4RjQOQg=="
},
"urix": { "urix": {
"version": "0.1.0", "version": "0.1.0",
"resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz",

@ -28,7 +28,8 @@
"numeral": "^2.0.6", "numeral": "^2.0.6",
"phoenix": "file:../../../deps/phoenix", "phoenix": "file:../../../deps/phoenix",
"phoenix_html": "file:../../../deps/phoenix_html", "phoenix_html": "file:../../../deps/phoenix_html",
"popper.js": "^1.14.3" "popper.js": "^1.14.3",
"urijs": "^1.19.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/polyfill": "^7.0.0-beta.46", "@babel/polyfill": "^7.0.0-beta.46",

Loading…
Cancel
Save