context resets to the initial value in the production environment #76419
Unanswered
alinayebi9080
asked this question in
App Router
Replies: 1 comment 2 replies
-
|
Have you been able to profile this? Does it behave the same way with a next build + start, locally? If so, then you could make a build with profiler enabled. Run your build with |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I encountered a problem while using the Next.js App Router (version 14.2.6). The issue occurs only in the production environment. it works perfectly fine in the local environment.
I'm using Context API to manage the state in my Next.js application. After saving data and using router.push to navigate to another page, the context value gets reset to its initial state. The strange part is that this issue only occurs in the production environment. In the local (development) environment, everything works fine.
What's even more puzzling is that when I navigate to a previous page and then try again, or if I refresh the page, the context behaves as expected.
At first, I thought this might be a problem with Context API, so I switched to using Zustand, but the same issue occurs. Given this, I suspect the issue might be related to the differences in optimization and rendering behavior between the development and production environments in Next.js App Router.
Beta Was this translation helpful? Give feedback.
All reactions