MCPcopy
hub / github.com/facebook/react / createRootErrorUpdate

Function createRootErrorUpdate

packages/react-reconciler/src/ReactFiberThrow.js:91–110  ·  view source on GitHub ↗
(
  root: FiberRoot,
  errorInfo: CapturedValue<mixed>,
  lane: Lane,
)

Source from the content-addressed store, hash-verified

89import {callComponentDidCatchInDEV} from './ReactFiberCallUserSpace';
90
91function createRootErrorUpdate(
92 root: FiberRoot,
93 errorInfo: CapturedValue<mixed>,
94 lane: Lane,
95): Update<mixed> {
96 const update = createUpdate(lane);
97 // Unmount the root by rendering null.
98 update.tag = CaptureUpdate;
99 // Caution: React DevTools currently depends on this property
100 // being called "element".
101 update.payload = {element: null};
102 update.callback = () => {
103 if (__DEV__) {
104 runWithFiberInDEV(errorInfo.source, logUncaughtError, root, errorInfo);
105 } else {
106 logUncaughtError(root, errorInfo);
107 }
108 };
109 return update;
110}
111
112function createClassErrorUpdate(lane: Lane): Update<mixed> {
113 const update = createUpdate(lane);

Callers 2

throwExceptionFunction · 0.85

Calls 3

createUpdateFunction · 0.90
runWithFiberInDEVFunction · 0.90
logUncaughtErrorFunction · 0.90

Tested by

no test coverage detected