( fiber: null | Fiber, callback: (A0, A1, A2, A3, A4) => T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, arg4: A4, )
| 44 | } |
| 45 | |
| 46 | export 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 | |
| 76 | export function resetCurrentFiber() { |
| 77 | if (__DEV__) { |
no test coverage detected