-
Notifications
You must be signed in to change notification settings - Fork 115
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
DynamicModuleLoader's children mounts twice #66
Comments
@anilanar thanks for reporting, Can you give a codesandbox with repro? |
https://codesandbox.io/s/8kx2jr7762 This behaviour is expected. If you do the following,
|
Sorry I didn't get a chance to look at it yet. I will take a look this week and get back to you. |
@anilanar I am not able to open the sandbox, I get following error. I will try again later today |
Perhaps codesandbox had problems when you tried it, I can open it. |
I can repro this and this is what I see, the storeState changes and thus React rerenders children |
I have this trouble too. This issue blocks releasing our app ( |
@navneet-g State not being up to date after store is updated (by |
@shockk in our app we are using following version of react-redux, and redux and don't see this issue. We are using it with React 16.8. Please try these versions for now to unblock the release. |
@anilanar which two different component roots are you mentioning? Please elaborate. |
First the following: and
On the second render, it will just render the In my fork, I removed |
Thanks @anilanar ... @abettadapur can you take a look? |
@abettadapur It works. To understand the effects of https://codesandbox.io/s/73r20x4jzj I think there's a difference only when mounting and not during updates. |
correct, the only difference should be at mount time. I don't think we can get around this for @navneet-g Let's move to publish the new version |
Thanks @anilanar and @abettadapur . |
Due to the following workaround:
https://github.com/Microsoft/redux-dynamic-modules/blob/e1046942f26db108f7dbb6ccc593824c9de716f5/packages/redux-dynamic-modules/src/DynamicModuleLoader.tsx#L142-L147
children of
DynamicModuleLoader
is mounted twice, once with a<Provider>
wrapper and once without the wrapper.I think this workaround is not needed anymore since React 16.6.3 andstore.getState()
gives the correct state on first render.Nevermind, it still behaves the same. I forked and unconditionally wrapped the component with the Provider always, which is better than double mounting IMO and has no side effects AFAIK.
The text was updated successfully, but these errors were encountered: