-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
notFound returns a 200 when loading.tsx is used #45801
Comments
Any Update? i faced the same issue |
The issue is still in latest stable release v13.4.16 |
Relates to #51021 This is kind of an awkward bug as removing |
Facing the same issue here as well (using app router with nextjs 14). I have to remove loading.tsx from my root directory in /app to make sure that not-found.tsx returns a 404 and not 200. |
Does it work with |
Hi - this behavior is expected and documented here: https://nextjs.org/docs/app/building-your-application/routing/loading-ui-and-streaming#status-codes When using When a response is streamed, a 200 status code is sent immediately. Once the |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true), TypeScript
Link to the code that reproduces this issue
https://github.com/vperrin/404-not-working-with-loading
To Reproduce
start the server
make an api call to localhost:3000/ (the call returns a 200 even though a notFound() is used)
remove loading.tsx from the root directory
make an api call to localhost:3000/ (the call returns a 404)
Describe the Bug
When notFound() is used in combination with loading.tsx, an 200 is returned instead of a 404
Expected Behavior
Even if loading.tsx is used, if a notFound() is used, a 404 should still be returned
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
yarn dev
The text was updated successfully, but these errors were encountered: