Not-found & Error behaviour not clear in docs #62089
-
We've recently been migrating to the app router, Based on the docs The notFound function allows you to render the not-found file within a route segment, with the behaviour seeming to be that we could bubble up the tree until we hit a This all worked fine for us to begin with, we opted for a top level Everything was great and behaving as we expected, if We then had a requirement to add some granular error handling scenarios deep in the tree at
This behaviour seems completely counter-intuitive, and means that we need to duplicate the not-found component everywhere we have an error component. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey 👋 I tried to recreate the described issue in the Stackblitz. CleanShot.2024-02-15.at.16.29.58.mp4 |
Beta Was this translation helpful? Give feedback.
Hey 👋
I tried to recreate the described issue in the Stackblitz.
The call to
notFound()
inproducts/[handle]/page.tsx
gets caught by(storefront)/not-found.tsx
CleanShot.2024-02-15.at.16.29.58.mp4
https://stackblitz.com/edit/stackblitz-starters-m8uujb?file=app%2F(storefront)%2Fproducts%2F[handle]%2Fpage.tsx