MCPcopy Index your code
hub / github.com/plotly/dash / enqueueCapturedUpdate

Function enqueueCapturedUpdate

dash/deps/react-dom@18.2.0.js:13565–13645  ·  view source on GitHub ↗
(workInProgress, capturedUpdate)

Source from the content-addressed store, hash-verified

13563 }
13564 }
13565 function enqueueCapturedUpdate(workInProgress, capturedUpdate) {
13566 // Captured updates are updates that are thrown by a child during the render
13567 // phase. They should be discarded if the render is aborted. Therefore,
13568 // we should only put them on the work-in-progress queue, not the current one.
13569 var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone.
13570
13571 var current = workInProgress.alternate;
13572
13573 if (current !== null) {
13574 var currentQueue = current.updateQueue;
13575
13576 if (queue === currentQueue) {
13577 // The work-in-progress queue is the same as current. This happens when
13578 // we bail out on a parent fiber that then captures an error thrown by
13579 // a child. Since we want to append the update only to the work-in
13580 // -progress queue, we need to clone the updates. We usually clone during
13581 // processUpdateQueue, but that didn't happen in this case because we
13582 // skipped over the parent when we bailed out.
13583 var newFirst = null;
13584 var newLast = null;
13585 var firstBaseUpdate = queue.firstBaseUpdate;
13586
13587 if (firstBaseUpdate !== null) {
13588 // Loop through the updates and clone them.
13589 var update = firstBaseUpdate;
13590
13591 do {
13592 var clone = {
13593 eventTime: update.eventTime,
13594 lane: update.lane,
13595 tag: update.tag,
13596 payload: update.payload,
13597 callback: update.callback,
13598 next: null
13599 };
13600
13601 if (newLast === null) {
13602 newFirst = newLast = clone;
13603 } else {
13604 newLast.next = clone;
13605 newLast = clone;
13606 }
13607
13608 update = update.next;
13609 } while (update !== null); // Append the captured update the end of the cloned list.
13610
13611
13612 if (newLast === null) {
13613 newFirst = newLast = capturedUpdate;
13614 } else {
13615 newLast.next = capturedUpdate;
13616 newLast = capturedUpdate;
13617 }
13618 } else {
13619 // There are no base updates.
13620 newFirst = newLast = capturedUpdate;
13621 }
13622

Callers 2

throwExceptionFunction · 0.70
updateClassComponentFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…