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

Function ensureUpdateQueues

code/higher-order-components/public/app.js:7902–7929  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

7900var q1 = void 0;
7901var q2 = void 0;
7902function ensureUpdateQueues(fiber) {
7903 q1 = q2 = null;
7904 // We'll have at least one and at most two distinct update queues.
7905 var alternateFiber = fiber.alternate;
7906 var queue1 = fiber.updateQueue;
7907 if (queue1 === null) {
7908 // TODO: We don't know what the base state will be until we begin work.
7909 // It depends on which fiber is the next current. Initialize with an empty
7910 // base state, then set to the memoizedState when rendering. Not super
7911 // happy with this approach.
7912 queue1 = fiber.updateQueue = createUpdateQueue(null);
7913 }
7914
7915 var queue2 = void 0;
7916 if (alternateFiber !== null) {
7917 queue2 = alternateFiber.updateQueue;
7918 if (queue2 === null) {
7919 queue2 = alternateFiber.updateQueue = createUpdateQueue(null);
7920 }
7921 } else {
7922 queue2 = null;
7923 }
7924 queue2 = queue2 !== queue1 ? queue2 : null;
7925
7926 // Use module variables instead of returning a tuple
7927 q1 = queue1;
7928 q2 = queue2;
7929}
7930
7931function insertUpdateIntoFiber(fiber, update) {
7932 ensureUpdateQueues(fiber);

Callers 2

insertUpdateIntoFiberFunction · 0.70
throwExceptionFunction · 0.70

Calls 1

createUpdateQueueFunction · 0.70

Tested by

no test coverage detected