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

Function ensureUpdateQueues

code/new-context-api/public/app.js:7269–7296  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

7267var q1 = void 0;
7268var q2 = void 0;
7269function ensureUpdateQueues(fiber) {
7270 q1 = q2 = null;
7271 // We'll have at least one and at most two distinct update queues.
7272 var alternateFiber = fiber.alternate;
7273 var queue1 = fiber.updateQueue;
7274 if (queue1 === null) {
7275 // TODO: We don't know what the base state will be until we begin work.
7276 // It depends on which fiber is the next current. Initialize with an empty
7277 // base state, then set to the memoizedState when rendering. Not super
7278 // happy with this approach.
7279 queue1 = fiber.updateQueue = createUpdateQueue(null);
7280 }
7281
7282 var queue2 = void 0;
7283 if (alternateFiber !== null) {
7284 queue2 = alternateFiber.updateQueue;
7285 if (queue2 === null) {
7286 queue2 = alternateFiber.updateQueue = createUpdateQueue(null);
7287 }
7288 } else {
7289 queue2 = null;
7290 }
7291 queue2 = queue2 !== queue1 ? queue2 : null;
7292
7293 // Use module variables instead of returning a tuple
7294 q1 = queue1;
7295 q2 = queue2;
7296}
7297
7298function insertUpdateIntoFiber(fiber, update) {
7299 ensureUpdateQueues(fiber);

Callers 2

insertUpdateIntoFiberFunction · 0.70
throwExceptionFunction · 0.70

Calls 1

createUpdateQueueFunction · 0.70

Tested by

no test coverage detected