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

Function ensureUpdateQueues

code/one-direction-data-flow/public/app.js:7781–7808  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

7779var q1 = void 0;
7780var q2 = void 0;
7781function ensureUpdateQueues(fiber) {
7782 q1 = q2 = null;
7783 // We'll have at least one and at most two distinct update queues.
7784 var alternateFiber = fiber.alternate;
7785 var queue1 = fiber.updateQueue;
7786 if (queue1 === null) {
7787 // TODO: We don't know what the base state will be until we begin work.
7788 // It depends on which fiber is the next current. Initialize with an empty
7789 // base state, then set to the memoizedState when rendering. Not super
7790 // happy with this approach.
7791 queue1 = fiber.updateQueue = createUpdateQueue(null);
7792 }
7793
7794 var queue2 = void 0;
7795 if (alternateFiber !== null) {
7796 queue2 = alternateFiber.updateQueue;
7797 if (queue2 === null) {
7798 queue2 = alternateFiber.updateQueue = createUpdateQueue(null);
7799 }
7800 } else {
7801 queue2 = null;
7802 }
7803 queue2 = queue2 !== queue1 ? queue2 : null;
7804
7805 // Use module variables instead of returning a tuple
7806 q1 = queue1;
7807 q2 = queue2;
7808}
7809
7810function insertUpdateIntoFiber(fiber, update) {
7811 ensureUpdateQueues(fiber);

Callers 2

insertUpdateIntoFiberFunction · 0.70
throwExceptionFunction · 0.70

Calls 1

createUpdateQueueFunction · 0.70

Tested by

no test coverage detected