Skip to content

Inefficient State Management in Redux Store (client/store.js) #3418

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

Closed
yashodipmore opened this issue Mar 25, 2025 · 2 comments
Closed

Inefficient State Management in Redux Store (client/store.js) #3418

yashodipmore opened this issue Mar 25, 2025 · 2 comments

Comments

@yashodipmore
Copy link

Increasing Access

Unsure (Community input on how this impacts accessibility is welcome.)

Feature enhancement details

Currently, the Redux store in client/store.js is not optimally structured, leading to unnecessary re-renders, excessive memory usage, and inefficient state updates. This impacts the overall performance of the p5.js Web Editor.

Issues Identified:
Overly Large Single Store Slice:

Some state variables are combined in a single slice, causing redundant updates when only a part of the state changes.

Unnecessary State Persistence:

Certain temporary values are stored in Redux when they could be managed using React’s local state.

Inefficient Selectors and State Subscriptions:

Components subscribe to the entire store instead of selecting only necessary values, causing unnecessary renders.

Proposed Solution:
Refactor the Redux store by splitting large slices into smaller, more manageable ones.

Move transient UI states (e.g., modal open/close) to local component state where possible.

Optimize selectors to prevent unnecessary component re-renders.

Implement useMemo and useCallback to prevent excessive computations.

Expected Benefits:
✅ Improved performance and reduced unnecessary re-renders.
✅ More maintainable and scalable Redux structure.
✅ Enhanced developer experience for future contributors.

Copy link

welcome bot commented Mar 25, 2025

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

@raclim
Copy link
Collaborator

raclim commented Mar 25, 2025

Thanks for opening this!

We do currently have an issue (2042) open dedicated to migrating from using Redux to Redux Toolkit altogether, which we currently have a few open PRs already for. To consolidate and organize issues, I'm going to close this one but please feel free to check out a few of the PRs that are open!

@raclim raclim closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants