HomePhabricator

[Cashtab] Patch render logic for spinner

Description

[Cashtab] Patch render logic for spinner

Summary:
Somewhere a long time ago, probably while handling wallet migrations, this spinner functionality was broken.

Patch.

Cashtab uses a Spinner component to lock the UI while wallet data is being written to storage. loading is provided by context, so any screen may arbitrarily set loading to true if it is necessary to lock the UI while some data necessary for user action is loaded. It is mainly used for when we update the wallet's utxo set, though we only briefly lock the UI here while the UTXO set is being written to storage.

One issue with Cashtab now is that wallet changes can be "too fast," and trigger too many write actions and state updates. I have a stack of diffs in now to handle this. However, one thing they need to work is for the loading spinner to actually render when loading is set to true. The logic for this was broken some time ago but this was not noticed as we also have not been using loading from screen's other than the App screen; it has primarily been used for the niche use case of a user migrating to an updated wallet shape.

This diff fixes the loading functionality so that a Spinner is rendered whenever loading is true. This change is simple but the knock-on impact on Cashtab's testing could be complex, because almost every test waits for loading to complete in some way before checking for expected data to be rendered. Different screens load in different times and make use of different limited loading components, so each test must be customized for handling this appropriately.

Ideally, we will have a streamlined and standardized loading approach -- which this top level spinner will support. However will take some time to get here, and patching this issue now is imo the first step.

Test Plan:
npm test

The test added in App.test.js is the one that specifically confirms expected behavior of this diff.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien, emack

Differential Revision: https://reviews.bitcoinabc.org/D17549

Details

Provenance
bytesofmanAuthored on Fri, Jan 17, 02:02
bytesofmanPushed on Fri, Jan 17, 21:32
Reviewer
Restricted Project
Differential Revision
D17549: [Cashtab] Patch render logic for spinner
Parents
rABC0377d768572f: [electrum] trezor: implement "seedless" mode (option during initialization)
Branches
Unknown
Tags
Unknown