Skip to content

Commit

Permalink
Clear 'TransactionCacheRegistry' whenever 'AccountListManager' gets
Browse files Browse the repository at this point in the history
cleared. This ensures cache entries aren't 'dangling' when recreating
the account list.

Without this fix, transaction history will make extra tx api request
when insight indexer's used. This is because
'InsightApiHelper.extendChains' is updating 'TransactionCacheRegistry'
with the assumption that it refers to the same txCache object as the
wallet.
  • Loading branch information
greatwolf committed Sep 6, 2022
1 parent 085c504 commit e9bd549
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Background.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,14 @@ var _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
value: !0
});
var r = e("lodash"),
i = function()
i = e("../services/transaction-cache-registry"),
a = function()
{
function e()
{}
return e.clearAccountList = function()
{
i.TransactionCacheRegistry.clearCache()
e.accountList.length = 0,
e._loaded = !1
},
Expand Down Expand Up @@ -470,9 +472,10 @@ var _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
e._loaded = !1,
e
}();
n.AccountListManager = i
n.AccountListManager = a
},
{
"../services/transaction-cache-registry": 121,
lodash: 368
}],
3: [function(e, t, n)
Expand Down Expand Up @@ -11998,6 +12001,10 @@ var _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
{
e._instances[t] ? console.log("new txCache not registered, one is already registered") : e._instances[t] = n
},
e.clearCache = function()
{
for (var k in e._instances) delete e._instances[k]
},
e._instances = {},
e
}();
Expand Down

0 comments on commit e9bd549

Please sign in to comment.