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

Function processUpdateQueue

code/event-handlers/public/app.js:7324–7458  ·  view source on GitHub ↗
(current, workInProgress, queue, instance, props, renderExpirationTime)

Source from the content-addressed store, hash-verified

7322}
7323
7324function processUpdateQueue(current, workInProgress, queue, instance, props, renderExpirationTime) {
7325 if (current !== null && current.updateQueue === queue) {
7326 // We need to create a work-in-progress queue, by cloning the current queue.
7327 var currentQueue = queue;
7328 queue = workInProgress.updateQueue = {
7329 baseState: currentQueue.baseState,
7330 expirationTime: currentQueue.expirationTime,
7331 first: currentQueue.first,
7332 last: currentQueue.last,
7333 isInitialized: currentQueue.isInitialized,
7334 capturedValues: currentQueue.capturedValues,
7335 // These fields are no longer valid because they were already committed.
7336 // Reset them.
7337 callbackList: null,
7338 hasForceUpdate: false
7339 };
7340 }
7341
7342 {
7343 // Set this flag so we can warn if setState is called inside the update
7344 // function of another setState.
7345 queue.isProcessing = true;
7346 }
7347
7348 // Reset the remaining expiration time. If we skip over any updates, we'll
7349 // increase this accordingly.
7350 queue.expirationTime = NoWork;
7351
7352 // TODO: We don't know what the base state will be until we begin work.
7353 // It depends on which fiber is the next current. Initialize with an empty
7354 // base state, then set to the memoizedState when rendering. Not super
7355 // happy with this approach.
7356 var state = void 0;
7357 if (queue.isInitialized) {
7358 state = queue.baseState;
7359 } else {
7360 state = queue.baseState = workInProgress.memoizedState;
7361 queue.isInitialized = true;
7362 }
7363 var dontMutatePrevState = true;
7364 var update = queue.first;
7365 var didSkip = false;
7366 while (update !== null) {
7367 var updateExpirationTime = update.expirationTime;
7368 if (updateExpirationTime > renderExpirationTime) {
7369 // This update does not have sufficient priority. Skip it.
7370 var remainingExpirationTime = queue.expirationTime;
7371 if (remainingExpirationTime === NoWork || remainingExpirationTime > updateExpirationTime) {
7372 // Update the remaining expiration time.
7373 queue.expirationTime = updateExpirationTime;
7374 }
7375 if (!didSkip) {
7376 didSkip = true;
7377 queue.baseState = state;
7378 }
7379 // Continue to the next update.
7380 update = update.next;
7381 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