-
-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audit / Improve Async State Management #236
Comments
MyEtherWallet/MyEtherWallet#149 is an example of async state not being handled properly. |
I think this one can be tricky, since many redux states require multiple loaders. For instance, the wallet reducer should have one loader for its ETH value, and separate loader(s) for the token values, and separate loader(s) for equivalent currency values. Having one and only one key for loading doesn't give us that level of granularity. |
It should also be noted that token balances are loaded via parity and eth balances, transaction count, and other items necessary to send a transaction are loaded via geth. This is to prevent token balances not loading from preventing a user from sending a transaction in times of very high traffic, such as during ICOs. |
Agreed, this issue is to create / manage state for each async action. We
should should standardize on what format we hold each state in however (e.g
isLoading[action] vs isFetching[action]).
1. Determine where async action state isn't being managed.
2. Manage all async action state (with a different top-level key for each corresponding value).
2a. Do so in a standardized format.
|
I want to outline what my research has been so far and the strategy to tackle this issue will be here: In my research dealing with the RPC calls so far it seems like there isn't we don't always handle errors currently. In issues like #462 #272 and #372 alot these errors cause certain functions to stop working on MEW and worse, sometimes they're swallowed, so we don't even know if they're there. In my Error Auditing PR #384 I have started the preliminary work to fix this by adding JSONSchema validators to the RPC calls. Since we expect the data returned to be represented a certain way, if it deviates from that specific object format, our UI won't be able to handle it, so we should throw an error. Now, we should look at the sagas and ensure that each error is not only properly detected, rather than just calling a Strategy:
|
Currently, we do not keep track of all state of a network request / async action.
By keeping track of the state of a network request, we can show users spinners/give them feedback while the async action resolves.
In addition to auditing and improving state management, it would be helpful to standardize on a specific format for keeping state of a specific network.
E.g.
isLoading
/hasErrored
/errorMessage
The text was updated successfully, but these errors were encountered: