Skip to content

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

@whoabuddy

Description

@whoabuddy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions