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

Function ensureUpdateQueues

code/communication/public/app.js:7943–7970  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

7941var q1 = void 0;
7942var q2 = void 0;
7943function ensureUpdateQueues(fiber) {
7944 q1 = q2 = null;
7945 // We'll have at least one and at most two distinct update queues.
7946 var alternateFiber = fiber.alternate;
7947 var queue1 = fiber.updateQueue;
7948 if (queue1 === null) {
7949 // TODO: We don't know what the base state will be until we begin work.
7950 // It depends on which fiber is the next current. Initialize with an empty
7951 // base state, then set to the memoizedState when rendering. Not super
7952 // happy with this approach.
7953 queue1 = fiber.updateQueue = createUpdateQueue(null);
7954 }
7955
7956 var queue2 = void 0;
7957 if (alternateFiber !== null) {
7958 queue2 = alternateFiber.updateQueue;
7959 if (queue2 === null) {
7960 queue2 = alternateFiber.updateQueue = createUpdateQueue(null);
7961 }
7962 } else {
7963 queue2 = null;
7964 }
7965 queue2 = queue2 !== queue1 ? queue2 : null;
7966
7967 // Use module variables instead of returning a tuple
7968 q1 = queue1;
7969 q2 = queue2;
7970}
7971
7972function insertUpdateIntoFiber(fiber, update) {
7973 ensureUpdateQueues(fiber);

Callers 2

insertUpdateIntoFiberFunction · 0.70
throwExceptionFunction · 0.70

Calls 1

createUpdateQueueFunction · 0.70

Tested by

no test coverage detected