From 2beda0c3548cb44fef0443d054ee0fc3b74eafdc Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 16 Oct 2014 16:02:32 -0300 Subject: [PATCH] refreshing wallet clears balance cache --- js/controllers/sidebar.js | 1 + js/services/controllerUtils.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/js/controllers/sidebar.js b/js/controllers/sidebar.js index 853353905..a634fc641 100644 --- a/js/controllers/sidebar.js +++ b/js/controllers/sidebar.js @@ -39,6 +39,7 @@ angular.module('copayApp.controllers').controller('SidebarController', function( if (w.isReady()) { w.sendWalletReady(); if ($rootScope.addrInfos.length > 0) { + controllerUtils.clearBalanceCache(w); controllerUtils.updateBalance(w, function() { $rootScope.$digest(); }); diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index b58cd37d1..067bbffd3 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -240,6 +240,10 @@ angular.module('copayApp.services') }; var _balanceCache = {}; + root.clearBalanceCache = function(w) { + delete _balanceCache[w.getId()]; + }; + root.updateBalance = function(w, cb) { var updateScope = function(w, data, cb2) { var satToUnit = 1 / w.settings.unitToSatoshi;