MCPcopy Create free account
hub / github.com/plotly/dash / enqueueCapturedUpdate

Function enqueueCapturedUpdate

dash/deps/react-dom@18.3.1.js:14678–14758  ·  view source on GitHub ↗
(workInProgress, capturedUpdate)

Source from the content-addressed store, hash-verified

14676 }
14677 }
14678 function enqueueCapturedUpdate(workInProgress, capturedUpdate) {
14679 // Captured updates are updates that are thrown by a child during the render
14680 // phase. They should be discarded if the render is aborted. Therefore,
14681 // we should only put them on the work-in-progress queue, not the current one.
14682 var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone.
14683
14684 var current = workInProgress.alternate;
14685
14686 if (current !== null) {
14687 var currentQueue = current.updateQueue;
14688
14689 if (queue === currentQueue) {
14690 // The work-in-progress queue is the same as current. This happens when
14691 // we bail out on a parent fiber that then captures an error thrown by
14692 // a child. Since we want to append the update only to the work-in
14693 // -progress queue, we need to clone the updates. We usually clone during
14694 // processUpdateQueue, but that didn't happen in this case because we
14695 // skipped over the parent when we bailed out.
14696 var newFirst = null;
14697 var newLast = null;
14698 var firstBaseUpdate = queue.firstBaseUpdate;
14699
14700 if (firstBaseUpdate !== null) {
14701 // Loop through the updates and clone them.
14702 var update = firstBaseUpdate;
14703
14704 do {
14705 var clone = {
14706 eventTime: update.eventTime,
14707 lane: update.lane,
14708 tag: update.tag,
14709 payload: update.payload,
14710 callback: update.callback,
14711 next: null
14712 };
14713
14714 if (newLast === null) {
14715 newFirst = newLast = clone;
14716 } else {
14717 newLast.next = clone;
14718 newLast = clone;
14719 }
14720
14721 update = update.next;
14722 } while (update !== null); // Append the captured update the end of the cloned list.
14723
14724
14725 if (newLast === null) {
14726 newFirst = newLast = capturedUpdate;
14727 } else {
14728 newLast.next = capturedUpdate;
14729 newLast = capturedUpdate;
14730 }
14731 } else {
14732 // There are no base updates.
14733 newFirst = newLast = capturedUpdate;
14734 }
14735

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…