From a15f357998e84ca011bf07fb93e67b36a22684a4 Mon Sep 17 00:00:00 2001 From: jimmay5469 Date: Fri, 22 Jun 2018 15:33:47 -0400 Subject: [PATCH] Only load in new transactions on page 1 Co-authored-by: Stamates --- apps/explorer_web/assets/js/pages/address.js | 26 +++++++++++--------- apps/explorer_web/assets/package-lock.json | 5 ++++ apps/explorer_web/assets/package.json | 3 ++- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/apps/explorer_web/assets/js/pages/address.js b/apps/explorer_web/assets/js/pages/address.js index d0bde59501..cb7de204cd 100644 --- a/apps/explorer_web/assets/js/pages/address.js +++ b/apps/explorer_web/assets/js/pages/address.js @@ -1,4 +1,5 @@ import $ from 'jquery' +import URI from 'urijs' import socket from '../socket' if (window.page === 'address') { @@ -7,17 +8,20 @@ if (window.page === 'address') { .receive('ok', resp => { console.log('Joined successfully', `addresses:${window.addressHash}`, resp) }) .receive('error', resp => { console.log('Unable to join', `addresses:${window.addressHash}`, resp) }) - const $emptyTransactionsList = $('[data-selector="empty-transactions-list"]') - if ($emptyTransactionsList) { - channel.on('transaction', () => { - window.location.reload() - }) - } + const currentLocation = URI(window.location) + if(!currentLocation.hasQuery('block_number')) { + const $emptyTransactionsList = $('[data-selector="empty-transactions-list"]') + if ($emptyTransactionsList) { + channel.on('transaction', () => { + window.location.reload() + }) + } - const $transactionsList = $('[data-selector="transactions-list"]') - if ($transactionsList) { - channel.on('transaction', (msg) => { - $transactionsList.prepend(msg.transaction) - }) + const $transactionsList = $('[data-selector="transactions-list"]') + if ($transactionsList) { + channel.on('transaction', (msg) => { + $transactionsList.prepend(msg.transaction) + }) + } } } diff --git a/apps/explorer_web/assets/package-lock.json b/apps/explorer_web/assets/package-lock.json index 9aa7fbcde3..cf5d0bca91 100644 --- a/apps/explorer_web/assets/package-lock.json +++ b/apps/explorer_web/assets/package-lock.json @@ -8164,6 +8164,11 @@ "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": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", diff --git a/apps/explorer_web/assets/package.json b/apps/explorer_web/assets/package.json index afc1855de7..2aba6cb072 100644 --- a/apps/explorer_web/assets/package.json +++ b/apps/explorer_web/assets/package.json @@ -28,7 +28,8 @@ "numeral": "^2.0.6", "phoenix": "file:../../../deps/phoenix", "phoenix_html": "file:../../../deps/phoenix_html", - "popper.js": "^1.14.3" + "popper.js": "^1.14.3", + "urijs": "^1.19.1" }, "devDependencies": { "@babel/polyfill": "^7.0.0-beta.46",