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

Centralize state management #21

Merged
merged 6 commits into from
Feb 2, 2024
Merged

Centralize state management #21

merged 6 commits into from
Feb 2, 2024

Conversation

dpgraham4401
Copy link
Member

@dpgraham4401 dpgraham4401 commented Feb 2, 2024

Description

This PR centralizes the state management into the zustand store. out store now only exposes a select number of actions, each of which update different parts of the state structure. Before we had a large number of actions that only updates a limited part of the slice/state, and we relied on react hooks to make sure the actions stayed in sync. As a result, we has instances where nodes where created but the edges remained.

In addition, we now only create nodes and edges in the store when necessary (we still hold the entire decision tree in state as a config then create nodes and edges from it as necessary). This opens the door to taking action on changes like onNodesChange or onEdgesChange.

Issue ticket number and link

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

…number of actions that each updates the complex state

This is a departure from teh old slice that exposes many actions that only updated limited amounts of state, then we relied on react for syncing those updates.
the structure is similar to what we have before, we have a hook that wraps around the store and exposes methods, and a hook that (uses the wrapper hook) and controls the decision tree
@github-actions github-actions bot added the dependencies changes to our dependencies label Feb 2, 2024
@dpgraham4401 dpgraham4401 merged commit 30a76cd into main Feb 2, 2024
5 checks passed
@dpgraham4401 dpgraham4401 deleted the centralize_state_mngt branch February 2, 2024 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies changes to our dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant