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

Function ensureUpdateQueues

code/styling/public/app.js:7908–7935  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

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

Callers 2

insertUpdateIntoFiberFunction · 0.70
throwExceptionFunction · 0.70

Calls 1

createUpdateQueueFunction · 0.70

Tested by

no test coverage detected