Skip to content

Save recent network balances in local storage#5843

Merged
danfinlay merged 4 commits intodevelopfrom
cache-network-balances-local-storage
Nov 30, 2018
Merged

Save recent network balances in local storage#5843
danfinlay merged 4 commits intodevelopfrom
cache-network-balances-local-storage

Conversation

@danjm
Copy link
Contributor

@danjm danjm commented Nov 27, 2018

This PR prevents errors caused by null account balances. This problem is described in detail #5842

While we need to resolve the root cause of that as soon as possible, this PR provides a front end band-aid by saving the most non-null balance for each account in local storage. If the account balance is null when we select it from state, we will instead return the most recent cached value.

These null returns are very inconsistent and almost never happen two blocks in a row, so the account balance will (almost always) be at most one block out of date.

@danjm danjm force-pushed the cache-network-balances-local-storage branch 3 times, most recently from d82e5a8 to 929bd56 Compare November 28, 2018 15:12
@metamaskbot
Copy link
Collaborator

Builds ready [929bd56]: mascara, chrome, firefox, edge, opera

@danjm danjm force-pushed the cache-network-balances-local-storage branch from 929bd56 to 6b0500b Compare November 29, 2018 13:42
@danjm danjm force-pushed the cache-network-balances-local-storage branch from 6b0500b to cf2db0f Compare November 29, 2018 16:03
@danjm danjm force-pushed the cache-network-balances-local-storage branch from cf2db0f to f4cc41c Compare November 29, 2018 19:55
@metamaskbot
Copy link
Collaborator

Builds ready [f4cc41c]: mascara, chrome, firefox, edge, opera

@danjm danjm force-pushed the cache-network-balances-local-storage branch from f4cc41c to cd179e8 Compare November 30, 2018 02:33
@danjm danjm force-pushed the cache-network-balances-local-storage branch from cd179e8 to efa04db Compare November 30, 2018 03:16
@metamaskbot
Copy link
Collaborator

Builds ready [efa04db]: mascara, chrome, firefox, edge, opera

Copy link
Contributor

@whymarrh whymarrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few quick suggestions/comments

@metamaskbot
Copy link
Collaborator

Builds ready [c132f89]: mascara, chrome, firefox, edge, opera

@danfinlay danfinlay merged commit 4c24555 into develop Nov 30, 2018
@danjm danjm deleted the cache-network-balances-local-storage branch March 26, 2019 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants