MCPcopy Index your code
hub / github.com/react/react / panicOnRootError

Function panicOnRootError

packages/react-reconciler/src/ReactFiberWorkLoop.js:3257–3271  ·  view source on GitHub ↗
(root: FiberRoot, error: mixed)

Source from the content-addressed store, hash-verified

3255}
3256
3257function panicOnRootError(root: FiberRoot, error: mixed) {
3258 // There's no ancestor that can handle this exception. This should never
3259 // happen because the root is supposed to capture all errors that weren't
3260 // caught by an error boundary. This is a fatal error, or panic condition,
3261 // because we've run out of ways to recover.
3262 workInProgressRootExitStatus = RootFatalErrored;
3263 logUncaughtError(root, createCapturedValueAtFiber(error, root.current));
3264 // Set `workInProgress` to null. This represents advancing to the next
3265 // sibling, or the parent if there are no siblings. But since the root
3266 // has no siblings nor a parent, we set it to null. Usually this is
3267 // handled by `completeUnitOfWork` or `unwindWork`, but since we're
3268 // intentionally not calling those, we need set it here.
3269 // TODO: Consider calling `unwindWork` to pop the contexts.
3270 workInProgress = null;
3271}
3272
3273function completeUnitOfWork(unitOfWork: Fiber): void {
3274 // Attempt to complete the current unit of work, then move to the next

Callers 1

throwAndUnwindWorkLoopFunction · 0.85

Calls 2

logUncaughtErrorFunction · 0.90

Tested by

no test coverage detected