From c674634a56d31537064904788294b9309558c6c0 Mon Sep 17 00:00:00 2001 From: Javier Date: Thu, 22 Oct 2015 12:31:54 -0300 Subject: [PATCH] debounced transaction history --- src/js/controllers/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 85d734529..972050670 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -818,7 +818,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r }); } - self.updateTxHistory = function() { + self.updateHistory = function() { $log.debug('Updating Transaction History'); self.skipHistory = 0; self.txHistoryError = false; @@ -834,8 +834,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r }); }; - self.debouncedUpdateHistory = lodash.throttle(function() { - self.updateTxHistory(); + self.updateTxHistory = lodash.debounce(function() { + self.updateHistory(); + }, 1000); + + self.throttledUpdateHistory = lodash.throttle(function() { + self.updateHistory(); }, 5000); self.showErrorPopup = function(msg, cb) { @@ -1146,7 +1150,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r } else if (self.hasUnsafeConfirmed) { $log.debug('Wallet has transactions with few confirmations. Updating.') if (self.network == 'testnet') { - self.debouncedUpdateHistory(); + self.throttledUpdateHistory(); } else { self.updateTxHistory(); }