MCPcopy
hub / github.com/tastejs/todomvc / enqueueCapturedUpdate

Function enqueueCapturedUpdate

examples/typescript-react/js/bundle.js:11908–11929  ·  view source on GitHub ↗
(workInProgress, update)

Source from the content-addressed store, hash-verified

11906}
11907
11908function enqueueCapturedUpdate(workInProgress, update) {
11909 // Captured updates go into a separate list, and only on the work-in-
11910 // progress queue.
11911 var workInProgressQueue = workInProgress.updateQueue;
11912 if (workInProgressQueue === null) {
11913 workInProgressQueue = workInProgress.updateQueue = createUpdateQueue(workInProgress.memoizedState);
11914 } else {
11915 // TODO: I put this here rather than createWorkInProgress so that we don't
11916 // clone the queue unnecessarily. There's probably a better way to
11917 // structure this.
11918 workInProgressQueue = ensureWorkInProgressQueueIsAClone(workInProgress, workInProgressQueue);
11919 }
11920
11921 // Append the update to the end of the list.
11922 if (workInProgressQueue.lastCapturedUpdate === null) {
11923 // This is the first render phase update
11924 workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update;
11925 } else {
11926 workInProgressQueue.lastCapturedUpdate.next = update;
11927 workInProgressQueue.lastCapturedUpdate = update;
11928 }
11929}
11930
11931function ensureWorkInProgressQueueIsAClone(workInProgress, queue) {
11932 var current = workInProgress.alternate;

Callers 1

throwExceptionFunction · 0.85

Calls 2

createUpdateQueueFunction · 0.85

Tested by

no test coverage detected