Page MenuHomePhabricator

[Cashtab] Move caching config out of Ticker
AbandonedPublic

Authored by emack on Jun 26 2023, 05:37.

Details

Reviewers
bytesofman
Fabien
Group Reviewers
Restricted Project
Summary

Moving the default cashtab caching config out of Ticker.js and into its own config file.

Test Plan
  • grep -r currency.defaultCashtabCache src/ and ensure no output
  • npm test
  • npm start with a browser with no existing cashtab cache
  • upon app startup, open dev console -> Application -> IndexDB -> localforage -> keyvaluepairs and verify the cashtabCache value matches the config file
  • create a new wallet, receive a token, refresh the keyvaluepairs from above and verify the ID of the token you just received is populated in cashtabCache.tokenInfoById
  • close and reopen cashtab and verify the cache info from above persisted
  • open cashtab on a browser with an existing wallet that has existing cashtab cache and ensure its existing keyvaluepairs have not been reset

Diff Detail

Repository
rABC Bitcoin ABC
Branch
caching_config
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24174
Build 47958: Build Diffcashtab-tests
Build 47957: arc lint + arc unit

Event Timeline

emack requested review of this revision.Jun 26 2023, 05:37
Fabien requested changes to this revision.Jun 26 2023, 06:35
Fabien added a subscriber: Fabien.

This is certainly not a cache configuration, but default values for a cache so it doesn't belong to config/.

But first and foremost I don't understand the need for the defaultCashtabCache structure at all. What is the point of this global ? It seems to me that they should simply be initialization values for the cache variables located in the file where they are used.

cashtab/src/utils/validation.js
370–376

Unrelated to this diff, but this is a nice antipattern.

This revision now requires changes to proceed.Jun 26 2023, 06:35

The defaultCashtabCache structure is there to support the migration of legacy wallets and ensure they have the right cache attributes.
Will throw up a separate diff to address the antipattern in feedback.