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

State mangement refactor and update #630

Open
6 tasks
Dananji opened this issue Aug 28, 2024 · 2 comments
Open
6 tasks

State mangement refactor and update #630

Dananji opened this issue Aug 28, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Dananji
Copy link
Collaborator

Dananji commented Aug 28, 2024

Description

As a result of the investigation in #605 we've decided keep using React contexts for state management with the addition of custom hooks. With custom hooks we are able to break state updates and state related logic out of the UI components into separate modules.

This will allow us to;

  • maintain clean components focused on populating the UI instead of handling logic
  • easier maintenance of logic and state updates across the code
  • get rid of unwanted re-renders in components (improved performance)
  • re-use code related to state updates and logic across components

Done Looks Like

  • identify state update and logic related code in each component that can be separated into custom hooks
  • group these code blocks as needed to avoid duplication across custom hooks, e.g. structure-related updates and logic, player and structure related updates, etc. (there's probably a better way to group these once we've identified such code in the first step) to custom hooks
  • add comments as needed, e.g. in custom hooks, in components where custom hooks are used?
  • write new tests/use existing tests to build new unit test suites for each custom hook
  • use React hooks to minimize re-renders
  • manually test player related updated which are not covered in unit tests
@Dananji Dananji added the enhancement New feature or request label Aug 28, 2024
@Dananji
Copy link
Collaborator Author

Dananji commented Sep 6, 2024

Try to break the work into multiple PRs for each component if possible.

@Dananji Dananji self-assigned this Sep 13, 2024
@Dananji
Copy link
Collaborator Author

Dananji commented Sep 13, 2024

The new hooks and features we need to start this code work is included in React 18. The only change we would want to use to improve performance of the application that's added in React 19 is the compiler (it is still in experimental stages), which is not a blocker for us to continue with the code changes in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant