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

Question About State Persistence and Memory Usage #7713

Open
VariabileAleatoria opened this issue Feb 10, 2025 · 0 comments
Open

Question About State Persistence and Memory Usage #7713

VariabileAleatoria opened this issue Feb 10, 2025 · 0 comments

Comments

@VariabileAleatoria
Copy link

Hi guys, I'm sorry if this is not the right place to ask, feel free to close this and tell me where to ask.

I have a question about how state persistence is handled in this app.

I noticed that the state is first loaded into a variable (_state) and then accessed using persisted.get() to initialize React state variables in multiple providers. I understand that this approach ensures the state is available when needed, thanks to initPersistedState() delaying the app render.

However, wouldn't this mean that the state is effectively stored twice in memory—once in _state and once in React state—leading to unnecessary memory usage? Or is there an optimization that prevents this duplication?

Thanks in advance for any clarification!

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

No branches or pull requests

1 participant