Files
react/packages/react-server
f752617a2d [Fizz] Track Current debugTask and run it for onError Callbacks (#30182)
Stacked on #30174.

This tracks the current debugTask on the Task so that when an error is
thrown we can use it to run the `onError` (and `onShellError` and
`onFatalError`) callbacks within the Context of that task. Ideally it
would be associated with the error object but neither console.error [nor
reportError](https://crbug.com/350426235) reports this as the async
stack so we have to manually restore it.

That way when you inspect Fizz using node `--inspect` we show the right
async stack.

<img width="616" alt="Screenshot 2024-07-01 at 10 52 29 PM"
src="https://github.com/facebook/react/assets/63648/db68133e-124e-4509-8241-c67160db94fc">

This is equivalent to how we track the task that created the parent
server component or the Fiber:


https://github.com/facebook/react/blob/311d569412d2621102f31074e27a3981f4237c6b/packages/react-reconciler/src/ReactChildFiber.js#L1985

Then use them when invoking the error callbacks:


https://github.com/facebook/react/blob/311d569412d2621102f31074e27a3981f4237c6b/packages/react-reconciler/src/ReactFiberThrow.js#L104-L108

---------

Co-authored-by: Sebastian Silbermann <[email protected]>
2024-07-02 19:46:18 -04:00
..

react-server

This is an experimental package for creating custom React streaming server renderers.

Its API is not as stable as that of React, React Native, or React DOM, and does not follow the common versioning scheme.

Use it at your own risk.