-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
Context declared in _app undefined during SSR in dev #18917
Comments
I'm seeing the same issue with similar usage. The same code worked with Webpack 4 prior to upgrading to Webpack 5, if that information provides at all useful for debugging. |
I've been breaking my brain on this for some time already as well, we're seeing exactly the same issue in our project. @timneutkens let me know if you need help with reproducing this. |
I think this is a very simple, yet effective reproduction of the issue: https://github.com/stefanprobst/next-webpack5-issue |
I believe I am running into something similar (hard to quite pin it down) when navigating from one page to another that use the same context. The first page, The second page, const [state, dispatch] = React.useReducer(reducerFunc, {...session}, initState); At this point, the state object exists, but it has empty values for it's properties. If I simply navigate directly to the second page, there is no issue. The user session is initialized the same way it is on the first page. It seems like the context is persisting across these two pages (via |
HI, this is updated in the latest version of Next.js |
@ijjk I'm still seeing some issues;
When I add I will check the context bug as well, haven't spotted it yet, but with these kinds of refresh rates it's also not really viable for us to update. |
The context issue seems fixed, any clue why HMR could be broken in this upgrade? |
@PepijnSenders we haven't heard any other reports of the HMR time increasing as you described above, can you provide a reproduction on a fresh issue for the HMR time increase you are seeing so we can investigate it closer? |
Actually, HMR isn't working at all it just refreshes. I can try to repro, but isolating the issue will be hard because this page is huge! 😄 |
Removing the warnings didn't make it faster 😢 |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
Running into basically this issue #4194 here sometimes, only in dev.
It's a fresh app, not much happening as of yet. A single context provider wrapping
Component
in app, and a index page using the context through a custom hook.The contexts initial value is null, but its filled through the provider. The custom hook throws on empty context value.
To Reproduce
Repo: https://github.com/ljosberinn/AuctionCraftSniper/blob/518d537557/src/pages/_app.tsx
Steps to reproduce the behavior, please provide code snippets or a repository:
next
)yarn dev
Expected behavior
Context should not be empty.
Screenshots
_app:
AuthContextProvider rendering with a value present
index calling hook:
Breakpoint where error is thrown:
Call Stack in VSCode Debugger:
Call Stack in Browser:
Call Stack in Console:
System information
The text was updated successfully, but these errors were encountered: