next-redux-wrapper icon indicating copy to clipboard operation
next-redux-wrapper copied to clipboard

client.js:1 Warning: Cannot update a component (`Home`) while rendering a different component (`App`). To locate the bad setState() call inside `App`

Open haar1shKhan opened this issue 1 year ago • 5 comments

Update issue when changing routes

. i have two routes in the my program which uses SSR and inside SSR funtion of first route (Home) dispatches a asyncthunk function which fetches a details about api and in second route (projects) dispatches a async function whichs fetches a detail about all the projects i have done. the details in each pages are hydrated but problem arises when i switch from one route to another using link component. image

haar1shKhan avatar May 20 '23 10:05 haar1shKhan

I am also getting this error on local. @kirill-konshin Any eta on this bug ?

hitendra-ap avatar Jun 19 '23 05:06 hitendra-ap

This PR seems to fix it: https://github.com/kirill-konshin/next-redux-wrapper/pull/540

jkesseler avatar Jun 27 '23 09:06 jkesseler

+1 here, exact same case and error. Btw if you are looking for fix, you can switch to pre-release version 9.0.0-rc2. You will need to do some refactoring, cause 9.0 has some changes in core concepts, but in the end it looks more straitforward in terms of getServerSideProps and store sync between server and client. https://github.com/kirill-konshin/next-redux-wrapper/tree/9.0.0-rc.2#readme

doshdik avatar Jul 22 '23 03:07 doshdik

I had the same issue, and it turned out that I was incorrectly memoizing my selectors/not memoizing my selectors. I'd recommend you try to add proxy-memoize, which IMO, is a much better experience and overall more robust than reselect, and see if the error still persists.

DanielOrtel avatar Sep 01 '23 16:09 DanielOrtel

This PR seems to fix it: #540

Yep, definitely. But need to clone forked repo, build it locally and patch node_modules. Then issue resolves. I believe it will be great to merge this PR. @kirill-konshin and thanks for awesome lib

dovranJorayev avatar Nov 20 '23 17:11 dovranJorayev