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

Function ensureUpdateQueues

code/controlled-uncontrolled/public/app.js:7232–7259  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

7230var q1 = void 0;
7231var q2 = void 0;
7232function ensureUpdateQueues(fiber) {
7233 q1 = q2 = null;
7234 // We'll have at least one and at most two distinct update queues.
7235 var alternateFiber = fiber.alternate;
7236 var queue1 = fiber.updateQueue;
7237 if (queue1 === null) {
7238 // TODO: We don't know what the base state will be until we begin work.
7239 // It depends on which fiber is the next current. Initialize with an empty
7240 // base state, then set to the memoizedState when rendering. Not super
7241 // happy with this approach.
7242 queue1 = fiber.updateQueue = createUpdateQueue(null);
7243 }
7244
7245 var queue2 = void 0;
7246 if (alternateFiber !== null) {
7247 queue2 = alternateFiber.updateQueue;
7248 if (queue2 === null) {
7249 queue2 = alternateFiber.updateQueue = createUpdateQueue(null);
7250 }
7251 } else {
7252 queue2 = null;
7253 }
7254 queue2 = queue2 !== queue1 ? queue2 : null;
7255
7256 // Use module variables instead of returning a tuple
7257 q1 = queue1;
7258 q2 = queue2;
7259}
7260
7261function insertUpdateIntoFiber(fiber, update) {
7262 ensureUpdateQueues(fiber);

Callers 2

insertUpdateIntoFiberFunction · 0.70
throwExceptionFunction · 0.70

Calls 1

createUpdateQueueFunction · 0.70

Tested by

no test coverage detected