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

Redux store reused between renders? #1276

Open
magnusottosson opened this issue Jan 5, 2022 · 3 comments
Open

Redux store reused between renders? #1276

magnusottosson opened this issue Jan 5, 2022 · 3 comments

Comments

@magnusottosson
Copy link

magnusottosson commented Jan 5, 2022

Hello,

I found an interesting bug in our production environment. One component that uses redux failed to set it redux store data but still tried to render. It then, in some cases, rendered data from a previous render for the same component. All renders are on the server.

This leads me to believe that the redux store is shared between requests? I have engine poolin on so I guess its just when I get the same engine instance?

Could this be true?

@Daniel15
Copy link
Member

Daniel15 commented Jan 5, 2022

Instances of the JS engine are shared between requests to make requests faster (as it only has to load the JS once). Either:

  1. Disable pooling. This will mean that each request creates a brand new JS engine, which slows down page load a bit.
  2. Clean up any global state at the end of your request (eg execute some JS in the JS engine). We can provide example code for this if needed.

@magnusottosson
Copy link
Author

OK! good. I just wanted to get it confirmed that state is shared :) But then I know and I can handle it.

@magnusottosson
Copy link
Author

Another question: It seems that when you run ReturnEngineToPool the engine is disposed (if pooling is used). Wouldnt this mean that the current engine wont be used again? So no shared state with the next component that renders?

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

2 participants