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

[Refactor] Move isSettingsModalOpen state from global state to zustand #4267

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

arielj
Copy link
Collaborator

@arielj arielj commented Jan 12, 2025

Since we added the support to use Zustand to handle state we can gradually migrate from GlobalState context to zustand to improve performance and also cleanup some code (GlobalState was just too big and complex).

This PR does a few things:

  • move the state to handle the Settings/Logs/Categories modal to be handled with a Zustand store (this reduces some re-renders, since it was in the global state it was re rendering the whole app every time it was opened/closed)
  • I added a SettingsModalWrapper component (since the state was used inside App, even moving the state to zustand was causing a re-render of the whole app)
  • since we can now have all the behavior and functions for this status scoped to a single file, I took the opportunity to make the functions more declarative, so instead of doing something like setIsSettingsModalOpen(true, 'log', gameInfo) we can do openGameLogsModal(gameInfo) to hide need of knowing the meaning of those arguments.

Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@arielj arielj added the pr:ready-for-review Feature-complete, ready for the grind! :P label Jan 12, 2025
@arielj arielj requested review from Etaash-mathamsetty, a team, flavioislima, CommandMC, Nocccer and imLinguin and removed request for a team January 12, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant