MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / ensureUpdateQueues

Function ensureUpdateQueues

code/dependency-injection/public/app.js:8001–8028  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

7999var q1 = void 0;
8000var q2 = void 0;
8001function ensureUpdateQueues(fiber) {
8002 q1 = q2 = null;
8003 // We'll have at least one and at most two distinct update queues.
8004 var alternateFiber = fiber.alternate;
8005 var queue1 = fiber.updateQueue;
8006 if (queue1 === null) {
8007 // TODO: We don't know what the base state will be until we begin work.
8008 // It depends on which fiber is the next current. Initialize with an empty
8009 // base state, then set to the memoizedState when rendering. Not super
8010 // happy with this approach.
8011 queue1 = fiber.updateQueue = createUpdateQueue(null);
8012 }
8013
8014 var queue2 = void 0;
8015 if (alternateFiber !== null) {
8016 queue2 = alternateFiber.updateQueue;
8017 if (queue2 === null) {
8018 queue2 = alternateFiber.updateQueue = createUpdateQueue(null);
8019 }
8020 } else {
8021 queue2 = null;
8022 }
8023 queue2 = queue2 !== queue1 ? queue2 : null;
8024
8025 // Use module variables instead of returning a tuple
8026 q1 = queue1;
8027 q2 = queue2;
8028}
8029
8030function insertUpdateIntoFiber(fiber, update) {
8031 ensureUpdateQueues(fiber);

Callers 2

insertUpdateIntoFiberFunction · 0.70
throwExceptionFunction · 0.70

Calls 1

createUpdateQueueFunction · 0.70

Tested by

no test coverage detected