Refactor notifications to redux #6

Merged
yehoshuasandler merged 3 commits from refactor-notifications-to-redux into main 2023-09-04 10:02:08 -05:00
yehoshuasandler commented 2023-09-04 09:59:16 -05:00 (Migrated from github.com)

Context

As features grow, UI modules have needed to share a fair amount of data between siblings. React Context was used to initially solve this issue and allowed to break up large state into isolated modules.

The isolated state modules were used more so for clarity of the file structure and readability of the Providers, not reusability.

The Provider structure is now becoming too tangled as each provider is practically used globally, but still has to be nested in a tree structure, causing undesirable design patterns.

The tangled mess makes moving code around very delicate and annoying.

These issues are likely to grow as the UX evolves.

Solution

Replace the React Contexts with Redux Tool Kit. RTK is much simpler to work with than older methods of working with Redux and will more fully embrace then global state management design that is being used. RTK inferred typing also reduces the boilerplate Typescript required for type safety.

An ADR to establish a clear philosophy for how state management fits into the architecture needs to be drafted up before the large Providers are replaced with RTK.


Related Todos

  1. Setup RTK Boilerplate
  2. Convert NotificationContext into a Redux Store
**Context** As features grow, UI modules have needed to share a fair amount of data between siblings. `React Context` was used to initially solve this issue and allowed to break up large state into isolated modules. The isolated state modules were used more so for clarity of the file structure and readability of the `Providers`, not reusability. The `Provider` structure is now becoming too tangled as each provider is practically used globally, but still has to be nested in a tree structure, causing undesirable design patterns. The tangled mess makes moving code around very delicate and annoying. These issues are likely to grow as the UX evolves. **Solution** Replace the `React Context`s with `Redux Tool Kit`. `RTK` is much simpler to work with than older methods of working with `Redux` and will more fully embrace then global state management design that is being used. `RTK` inferred typing also reduces the boilerplate Typescript required for type safety. An ADR to establish a clear philosophy for how state management fits into the architecture needs to be drafted up before the large `Providers` are replaced with `RTK`. <hr /> **Related Todos** 1. [Setup RTK Boilerplate](https://github.com/users/yehoshuasandler/projects/1/views/1?visibleFields=%5B%22Title%22%2C%22Assignees%22%2C%22Status%22%2C%22Linked+pull+requests%22%5D&pane=issue&itemId=37517913) 2. [Convert NotificationContext into a Redux Store](https://github.com/users/yehoshuasandler/projects/1/views/1?visibleFields=%5B%22Title%22%2C%22Assignees%22%2C%22Status%22%2C%22Linked+pull+requests%22%5D&pane=issue&itemId=37517937)
Sign in to join this conversation.
No description provided.