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

Function ensureUpdateQueues

code/third-party/public/app.js:7141–7168  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

7139var q1 = void 0;
7140var q2 = void 0;
7141function ensureUpdateQueues(fiber) {
7142 q1 = q2 = null;
7143 // We'll have at least one and at most two distinct update queues.
7144 var alternateFiber = fiber.alternate;
7145 var queue1 = fiber.updateQueue;
7146 if (queue1 === null) {
7147 // TODO: We don't know what the base state will be until we begin work.
7148 // It depends on which fiber is the next current. Initialize with an empty
7149 // base state, then set to the memoizedState when rendering. Not super
7150 // happy with this approach.
7151 queue1 = fiber.updateQueue = createUpdateQueue(null);
7152 }
7153
7154 var queue2 = void 0;
7155 if (alternateFiber !== null) {
7156 queue2 = alternateFiber.updateQueue;
7157 if (queue2 === null) {
7158 queue2 = alternateFiber.updateQueue = createUpdateQueue(null);
7159 }
7160 } else {
7161 queue2 = null;
7162 }
7163 queue2 = queue2 !== queue1 ? queue2 : null;
7164
7165 // Use module variables instead of returning a tuple
7166 q1 = queue1;
7167 q2 = queue2;
7168}
7169
7170function insertUpdateIntoFiber(fiber, update) {
7171 ensureUpdateQueues(fiber);

Callers 2

insertUpdateIntoFiberFunction · 0.70
throwExceptionFunction · 0.70

Calls 1

createUpdateQueueFunction · 0.70

Tested by

no test coverage detected