kirill-konshin / next-redux-wrapper

Redux wrapper for Next.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

haar1shKhan opened this issue · 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

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

This PR seems to fix it: #540

+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

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.

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