mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
When postpone is caught by user code, this will cause PPR not to properly prerender the static parts and thus we need to fail the build. This also adds some messaging about how to fix the error. Prior to this change, catching code that would normally trigger `postpone ` would silently fail, but the build outputs would be incorrect as there's no postpone data available. Relands #57477 with additional tests & fixes
20 lines
371 B
React
20 lines
371 B
React
import React, { Suspense } from 'react'
|
|
import { cookies } from 'next/headers'
|
|
|
|
export default async function Page() {
|
|
return (
|
|
<Suspense fallback={<div>Loading...</div>}>
|
|
<Foobar />
|
|
</Suspense>
|
|
)
|
|
}
|
|
|
|
async function Foobar() {
|
|
try {
|
|
cookies()
|
|
} catch (err) {
|
|
throw new Error('The original error was caught and rethrown.')
|
|
}
|
|
return null
|
|
}
|