envoylabs / whoami-ui

A UI for the whoami NFT-based nameservice
whoami-ui.vercel.app
Apache License 2.0
9 stars 3 forks source link

Use zustand for state management #100

Closed the-frey closed 2 years ago

the-frey commented 2 years ago

Attempt to more sensibly manage global state.

Not wild about how subs and events are kind of all in the same state object, but it works p well.

To test before merge:

Fixes #58

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/envoylabs/whoami-ui/zGjeTCPCY8wdWUwoqHx3uGikAwRj
✅ Preview: https://whoami-ui-git-58statemanagement-envoylabs.vercel.app

the-frey commented 2 years ago

~Initial poke around suggests that at some point in the 'fix the types and refactor' rampage, a lot of stuff has gotten broken. cool cool~

Seems like this was mostly ser/de as a result of persisting to local storage. Need to split these two sections of state into two slices and only persist the simple types. Maybe. Maybe we don't want to persist at all. https://github.com/pmndrs/zustand/wiki/Splitting-the-store-into-separate-slices