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

Function processUpdateQueue

code/redux/public/app.js:8245–8379  ·  view source on GitHub ↗
(current, workInProgress, queue, instance, props, renderExpirationTime)

Source from the content-addressed store, hash-verified

8243}
8244
8245function processUpdateQueue(current, workInProgress, queue, instance, props, renderExpirationTime) {
8246 if (current !== null && current.updateQueue === queue) {
8247 // We need to create a work-in-progress queue, by cloning the current queue.
8248 var currentQueue = queue;
8249 queue = workInProgress.updateQueue = {
8250 baseState: currentQueue.baseState,
8251 expirationTime: currentQueue.expirationTime,
8252 first: currentQueue.first,
8253 last: currentQueue.last,
8254 isInitialized: currentQueue.isInitialized,
8255 capturedValues: currentQueue.capturedValues,
8256 // These fields are no longer valid because they were already committed.
8257 // Reset them.
8258 callbackList: null,
8259 hasForceUpdate: false
8260 };
8261 }
8262
8263 {
8264 // Set this flag so we can warn if setState is called inside the update
8265 // function of another setState.
8266 queue.isProcessing = true;
8267 }
8268
8269 // Reset the remaining expiration time. If we skip over any updates, we'll
8270 // increase this accordingly.
8271 queue.expirationTime = NoWork;
8272
8273 // TODO: We don't know what the base state will be until we begin work.
8274 // It depends on which fiber is the next current. Initialize with an empty
8275 // base state, then set to the memoizedState when rendering. Not super
8276 // happy with this approach.
8277 var state = void 0;
8278 if (queue.isInitialized) {
8279 state = queue.baseState;
8280 } else {
8281 state = queue.baseState = workInProgress.memoizedState;
8282 queue.isInitialized = true;
8283 }
8284 var dontMutatePrevState = true;
8285 var update = queue.first;
8286 var didSkip = false;
8287 while (update !== null) {
8288 var updateExpirationTime = update.expirationTime;
8289 if (updateExpirationTime > renderExpirationTime) {
8290 // This update does not have sufficient priority. Skip it.
8291 var remainingExpirationTime = queue.expirationTime;
8292 if (remainingExpirationTime === NoWork || remainingExpirationTime > updateExpirationTime) {
8293 // Update the remaining expiration time.
8294 queue.expirationTime = updateExpirationTime;
8295 }
8296 if (!didSkip) {
8297 didSkip = true;
8298 queue.baseState = state;
8299 }
8300 // Continue to the next update.
8301 update = update.next;
8302 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