-
Notifications
You must be signed in to change notification settings - Fork 391
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
useInjectReducer updates store, leading to warning "Cannot update a component (x) while rendering a different component..." #179
Comments
hmm, I have no solution within this repo atm. I already removed redux-injectors lib out of this repo and implemented them manually since that repo is dead. But, it will take a while till I release this version (winter probably. Have no time in summer). |
@Can-Sahin where is it available? How do I implement? |
Same issue. Waiting for a new release |
To others, I simply removed the injectors. This issue may cause some unexpected behaviors in the frontend. |
https://github.com/International-Slackline-Association/slackmap-ui I have been working on this. You can see the new setup I made without injectors npm package. I don't have free time yet to update this repo, but if anybody is interested in solving it on their own then take a look. It's straightforward and explicit. Its in By the way, it uses RTK Query instead Saga. Plus, it's really a web app working if you need some project references :) |
Just chiming in that this issue seems to occur when using RTK's dispatcher within a NextJS SSR block. I have a simple app skeleton that I am building out. It is using the SSR block to set the nav links into the state depending on the URL parameters. There is nowhere in the app's components where the store is changed other than with an When I transition from the first page to the next this warning appears. The only way I can make it go away is by removing the Example SSR Block:
The NavDrawer component (has the dispatch):
The NavLinks component (If I remove the selector from here the warning goes away):
This has been doing my head in for a few days now, any advice? |
Description
We have 2 components, one is parent and one is child. Both components have its own slice. When the child component is rendered for the first time, a warning will be thrown in the console:
This is caused by
useInjectReducer
hook. My interpretation of the issue is that the hook make change to the store, affecting both the parent and the child component.https://github.com/react-boilerplate/redux-injectors/blob/master/src/injectReducer.js#L69
This is briefly mentioned at the end in #54 , after it is closed.
This issue in react-redux seems to be related reduxjs/react-redux#1640.
Steps to reproduce
Versions
The text was updated successfully, but these errors were encountered: