Skip to content
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

⚡[FEAT] use jotai and KV for state management #4

Open
whoabuddy opened this issue Mar 3, 2023 · 0 comments
Open

⚡[FEAT] use jotai and KV for state management #4

whoabuddy opened this issue Mar 3, 2023 · 0 comments

Comments

@whoabuddy
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

A lot of the data stored on the page is queried more often then it needs to be, and only stored in localstorage.

Describe the solution you'd like

See if it's possible to use a loadable atom to track global state, such that:

  • the atom config is stored in KV as a JSON object
  • the loadable util helps track state of atom
    • if loading, return current value, show status/spinner? race condition? by back-end?
      • fetch on backend for base atom(s), derive atom used for state in app
    • if hasData and lastBlock < currentBlock, update, set, return value
    • if hasError, retain last value, return last value, log? show?
  • the front-end reads/loads the data from KV, and can trigger loading on mismatch
    • make sure loading operation can only fire once until state updated

Describe alternatives you've considered

It works as-is, but this model would help bring in more data from the contracts, and set a foundation for exposing more data in the UI.

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

No branches or pull requests

1 participant