1

I had created my next js app with version 9.3.5 , and the authentication is worked fine. with the new updates of next-redux-wrapper and next js, when i refresh the page, the user is no longer authenticated but the cookie still exists.

i don't know why it's not working anymore, if you can check the sandbox and see what i am doing wrong

The sandbox with version 9.3.5, the authentication is working fine. the sandbox

and the sandbox with version 9.4.4 where the authentication is not persisted. the sandbox

1 Answer 1

4

i have now found the solution. With the introduction of getServerSideProps and getStaticProps, the two forms of pre-rendering only run on the server side which was not the case with getInitialProps which runs on the client side and server side.

In the reducers, in the swich cases, i have implemented the HYDRATE case first which will allow the client and server state to be reconciled because the state must merge in order to avoid the clash between client and server.

you can see the full code here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.