safe-airdrop icon indicating copy to clipboard operation
safe-airdrop copied to clipboard

Refactor state mgmt

Open schmanu opened this issue 2 years ago • 1 comments

Right now the state management grew to be very messy with a lot of state living inside of components and some state living in Contexts.

This makes the app hard to maintain and implement new features. In the next week I wanna focus on using some library (redux, redux-toolkit or mobx) to manage the state of the app nicely.

The idea is to have multiple stores for the app: i.e.

  • Token Information Store
  • Safe Balance Store
  • ENS Store
  • UI Store

These stores will simply hold the app's state and provide ways for components to change the state through defined actions and retrieve the state to display it.

By this refactoring all the logic should be moved into these stores out of the components.

Additionally we can implement the fetching / on chain logic into Services. By doing so we should achieve better ways to test our logic like ENS Resolution.

schmanu avatar Apr 22 '22 12:04 schmanu

Would this also allow us to use the backend logic from a script - by separating all the UI from the business/transaction building logic?

bh2smith avatar Apr 22 '22 13:04 bh2smith