[Cache Compoenents] Returning 200 Instead of 404 When Using Suspense and Cached Components #89254
Replies: 1 comment 2 replies
-
|
hello bro export default async function TopProductsPage({ return ( Loading... }>); } const TopProductsPageContent = async ({ return ... ;}; or Make Suspense optional (second solution but i think the first one is better ) have a nice day bro |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to return a
404 status codefor pages that don’t have any search params.However, because I’m using a
cache components, I have to wrap my async logic inside Suspense. The problem is thatnotFound()gets called after Suspense resolves, so Next.js already sends a200 status.Is there a proper way to handle this so the page still returns a true 404?
Example:
page path:
https://my-app.com/top-products?type=1&model=macpage path:
https://my-app.com/top-products(wants early return)Beta Was this translation helpful? Give feedback.
All reactions