forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reword PPR caught bail out to avoid "postpone" terminology (vercel#58223
) The "postpone" terminology is internal to React and can be used for more things than just this. It's also a mechanism we may or may not rely on. --------- Co-authored-by: Zack Tanner <[email protected]>
- Loading branch information
1 parent
d68bbd7
commit 2f68e62
Showing
6 changed files
with
40 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: Static Bail Out Caught | ||
--- | ||
|
||
## Why This Error Occurred | ||
|
||
When Partial Prerendering (PPR) is enabled, using APIs that opt into Dynamic Rendering like `cookies`, `headers`, or `fetch` (such as with `cache: 'no-store'` or `revalidate: 0`) will cause React to throw a special error object to know which part of the page cannot be statically generated - while still letting the rest of it be partially static. If you catch this error, it is not safe for us to generate any static data, and your build will fail. | ||
|
||
## Possible Ways to Fix It | ||
|
||
- Ensure that you are not wrapping Next.js APIs that opt into dynamic rendering in a `try/catch` block. | ||
- If you do wrap these APIs in a try/catch, make sure you re-throw the original error so it can be caught by Next.js. | ||
- Alternatively, insert [`unstable_noStore()`](docs/app/api-reference/functions/unstable_noStore) before the try/catch. | ||
|
||
```js | ||
import { unstable_noStore } from 'next/cache' | ||
|
||
async function fetchData() { | ||
unstable_noStore() // opt out before we even get to the try/catch | ||
try { | ||
const response = await fetch(url); | ||
... | ||
} catch (x) { | ||
... | ||
} | ||
} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters