mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
When navigating away from a page due to an MPA navigation or browser refresh, we were aborting any pending RSC requests. However, in the case where the abort was due to an MPA navigation, the browser would restore the execution context via the built-in bfcache, and the aborted fetch would cause React to get in an errored state, leading to "BodyStreamBuffer was aborted". Rather than aborting the pending requests, we instead mark that we would have aborted due to the page unloading. That still solves the original reason the flag was added (suppressing the fetch errors that get logged) Fixes NAR-519
20 lines
418 B
TypeScript
20 lines
418 B
TypeScript
'use client' // Error boundaries must be Client Components
|
|
|
|
export default function GlobalError({
|
|
error,
|
|
reset,
|
|
}: {
|
|
error: Error & { digest?: string }
|
|
reset: () => void
|
|
}) {
|
|
return (
|
|
// global-error must include html and body tags
|
|
<html>
|
|
<body>
|
|
<h2 id="global-error">Something went wrong!</h2>
|
|
<button onClick={() => reset()}>Try again</button>
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|