mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What #### Core This PR respect the error's digest when recieves new error occurred from server side, and it will be logged into client on production with the same `digest` property. If we discover the original RSC error in SSR error handler, retrieve the original error #### Tests * Move the errors related tests from `test/e2e/app-dir/app` to a separate test suite `test/e2e/app-dir/errors` * Add a new test case for logging the original RSC error * Add a new test case for logging the original Server Action error ### Why This will help associate the `digest` property of the errors logged from client with the actual generated server errors. Previously they're different as we might re-compute the digest proper in handler that react server renderer thinks it's a new error, which causes we have 2 different errors logged on server side, and 1 logged on client side. The one on client side can associate to the server errors but it's from react renderer which is not the original error. Closes NEXT-2094 Fixes #60684
30 lines
526 B
JavaScript
30 lines
526 B
JavaScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
|
|
import { serverAction } from './action'
|
|
|
|
export default function Home() {
|
|
const [response, setResponse] = useState(null)
|
|
|
|
return (
|
|
<div>
|
|
<button
|
|
id="button"
|
|
onClick={async function () {
|
|
try {
|
|
await serverAction()
|
|
} catch (e) {
|
|
console.log(e)
|
|
setResponse(e)
|
|
}
|
|
}}
|
|
>
|
|
Crash
|
|
</button>
|
|
<br />
|
|
<p id="digest">{response?.digest}</p>
|
|
</div>
|
|
)
|
|
}
|