(root, fiber, lane, eventTime)
| 25521 | } |
| 25522 | |
| 25523 | function scheduleUpdateOnFiber(root, fiber, lane, eventTime) { |
| 25524 | checkForNestedUpdates(); |
| 25525 | |
| 25526 | { |
| 25527 | if (isRunningInsertionEffect) { |
| 25528 | error('useInsertionEffect must not schedule updates.'); |
| 25529 | } |
| 25530 | } |
| 25531 | |
| 25532 | { |
| 25533 | if (isFlushingPassiveEffects) { |
| 25534 | didScheduleUpdateDuringPassiveEffects = true; |
| 25535 | } |
| 25536 | } // Mark that the root has a pending update. |
| 25537 | |
| 25538 | |
| 25539 | markRootUpdated(root, lane, eventTime); |
| 25540 | |
| 25541 | if ((executionContext & RenderContext) !== NoLanes && root === workInProgressRoot) { |
| 25542 | // This update was dispatched during the render phase. This is a mistake |
| 25543 | // if the update originates from user space (with the exception of local |
| 25544 | // hook updates, which are handled differently and don't reach this |
| 25545 | // function), but there are some internal React features that use this as |
| 25546 | // an implementation detail, like selective hydration. |
| 25547 | warnAboutRenderPhaseUpdatesInDEV(fiber); // Track lanes that were updated during the render phase |
| 25548 | } else { |
| 25549 | // This is a normal update, scheduled from outside the render phase. For |
| 25550 | // example, during an input event. |
| 25551 | { |
| 25552 | if (isDevToolsPresent) { |
| 25553 | addFiberToLanesMap(root, fiber, lane); |
| 25554 | } |
| 25555 | } |
| 25556 | |
| 25557 | warnIfUpdatesNotWrappedWithActDEV(fiber); |
| 25558 | |
| 25559 | if (root === workInProgressRoot) { |
| 25560 | // Received an update to a tree that's in the middle of rendering. Mark |
| 25561 | // that there was an interleaved update work on this root. Unless the |
| 25562 | // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render |
| 25563 | // phase update. In that case, we don't treat render phase updates as if |
| 25564 | // they were interleaved, for backwards compat reasons. |
| 25565 | if ( (executionContext & RenderContext) === NoContext) { |
| 25566 | workInProgressRootInterleavedUpdatedLanes = mergeLanes(workInProgressRootInterleavedUpdatedLanes, lane); |
| 25567 | } |
| 25568 | |
| 25569 | if (workInProgressRootExitStatus === RootSuspendedWithDelay) { |
| 25570 | // The root already suspended with a delay, which means this render |
| 25571 | // definitely won't finish. Since we have a new update, let's mark it as |
| 25572 | // suspended now, right before marking the incoming update. This has the |
| 25573 | // effect of interrupting the current render and switching to the update. |
| 25574 | // TODO: Make sure this doesn't override pings that happen while we've |
| 25575 | // already started rendering. |
| 25576 | markRootSuspended$1(root, workInProgressRootRenderLanes); |
| 25577 | } |
| 25578 | } |
| 25579 | |
| 25580 | ensureRootIsScheduled(root, eventTime); |
no test coverage detected
searching dependent graphs…