Skip to content

Commit 9cfb479

Browse files
committed
feat: cleans leftover tokens on net change
1 parent a0a0ea1 commit 9cfb479

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/sagas/networkSettings.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ function invalidUrl(tryUrl) {
263263
* already saved in the redux store.
264264
*/
265265
export function* persistNetworkSettings(action) {
266+
console.log(`persistNetworkSettings: ${JSON.stringify(action.payload)}`);
266267
// persists after reducer being updated
267268
const networkSettings = action.payload;
268269
try {
@@ -293,8 +294,13 @@ export function* persistNetworkSettings(action) {
293294

294295
// Stop wallet and clean its storage without clean its access data.
295296
wallet.stop({ cleanStorage: true, cleanAddresses: true, cleanTokens: true });
297+
298+
// Clean transaction history, addresses and registered tokens from local storage as well
299+
const storage = STORE.getStorage();
300+
yield call([storage, storage.cleanStorage], true, true, true);
301+
296302
// This action should clean the tokens history on redux.
297-
// In addition, the reload also clean the inmemory storage.
303+
// In addition, the reload also clean the in memory storage.
298304
yield put(reloadWalletRequested());
299305
}
300306

0 commit comments

Comments
 (0)