MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / processUpdateQueue

Function processUpdateQueue

code/composition/public/app.js:8132–8266  ·  view source on GitHub ↗
(current, workInProgress, queue, instance, props, renderExpirationTime)

Source from the content-addressed store, hash-verified

8130}
8131
8132function processUpdateQueue(current, workInProgress, queue, instance, props, renderExpirationTime) {
8133 if (current !== null && current.updateQueue === queue) {
8134 // We need to create a work-in-progress queue, by cloning the current queue.
8135 var currentQueue = queue;
8136 queue = workInProgress.updateQueue = {
8137 baseState: currentQueue.baseState,
8138 expirationTime: currentQueue.expirationTime,
8139 first: currentQueue.first,
8140 last: currentQueue.last,
8141 isInitialized: currentQueue.isInitialized,
8142 capturedValues: currentQueue.capturedValues,
8143 // These fields are no longer valid because they were already committed.
8144 // Reset them.
8145 callbackList: null,
8146 hasForceUpdate: false
8147 };
8148 }
8149
8150 {
8151 // Set this flag so we can warn if setState is called inside the update
8152 // function of another setState.
8153 queue.isProcessing = true;
8154 }
8155
8156 // Reset the remaining expiration time. If we skip over any updates, we'll
8157 // increase this accordingly.
8158 queue.expirationTime = NoWork;
8159
8160 // TODO: We don't know what the base state will be until we begin work.
8161 // It depends on which fiber is the next current. Initialize with an empty
8162 // base state, then set to the memoizedState when rendering. Not super
8163 // happy with this approach.
8164 var state = void 0;
8165 if (queue.isInitialized) {
8166 state = queue.baseState;
8167 } else {
8168 state = queue.baseState = workInProgress.memoizedState;
8169 queue.isInitialized = true;
8170 }
8171 var dontMutatePrevState = true;
8172 var update = queue.first;
8173 var didSkip = false;
8174 while (update !== null) {
8175 var updateExpirationTime = update.expirationTime;
8176 if (updateExpirationTime > renderExpirationTime) {
8177 // This update does not have sufficient priority. Skip it.
8178 var remainingExpirationTime = queue.expirationTime;
8179 if (remainingExpirationTime === NoWork || remainingExpirationTime > updateExpirationTime) {
8180 // Update the remaining expiration time.
8181 queue.expirationTime = updateExpirationTime;
8182 }
8183 if (!didSkip) {
8184 didSkip = true;
8185 queue.baseState = state;
8186 }
8187 // Continue to the next update.
8188 update = update.next;
8189 continue;

Callers 4

mountClassInstanceFunction · 0.70
resumeMountClassInstanceFunction · 0.70
updateClassInstanceFunction · 0.70
updateHostRootFunction · 0.70

Calls 1

getStateFromUpdateFunction · 0.70

Tested by

no test coverage detected