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

Function runWithFiberInDEV

packages/react-reconciler/src/ReactCurrentFiber.js:46–74  ·  view source on GitHub ↗
(
  fiber: null | Fiber,
  callback: (A0, A1, A2, A3, A4) => T,
  arg0: A0,
  arg1: A1,
  arg2: A2,
  arg3: A3,
  arg4: A4,
)

Source from the content-addressed store, hash-verified

44}
45
46export function runWithFiberInDEV<A0, A1, A2, A3, A4, T>(
47 fiber: null | Fiber,
48 callback: (A0, A1, A2, A3, A4) => T,
49 arg0: A0,
50 arg1: A1,
51 arg2: A2,
52 arg3: A3,
53 arg4: A4,
54): T {
55 if (__DEV__) {
56 const previousFiber = current;
57 setCurrentFiber(fiber);
58 try {
59 if (fiber !== null && fiber._debugTask) {
60 return fiber._debugTask.run(
61 callback.bind(null, arg0, arg1, arg2, arg3, arg4),
62 );
63 }
64 return callback(arg0, arg1, arg2, arg3, arg4);
65 } finally {
66 setCurrentFiber(previousFiber);
67 }
68 }
69 // These errors should never make it into a build so we don't need to encode them in codes.json
70 // eslint-disable-next-line react-internal/prod-error-codes
71 throw new Error(
72 'runWithFiberInDEV should never be called in production. This is a bug in React.',
73 );
74}
75
76export function resetCurrentFiber() {
77 if (__DEV__) {

Callers 15

executeDispatchesInOrderFunction · 0.90
warnForBlockInsideInlineFunction · 0.90
validateDOMNestingFunction · 0.90
commitClassDidMountFunction · 0.90
commitClassCallbacksFunction · 0.90
commitRootCallbacksFunction · 0.90
commitClassSnapshotFunction · 0.90

Calls 3

setCurrentFiberFunction · 0.85
runMethod · 0.80
callbackFunction · 0.50

Tested by

no test coverage detected