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

Function insertUpdateIntoFiber

code/styling/public/app.js:7937–7969  ·  view source on GitHub ↗
(fiber, update)

Source from the content-addressed store, hash-verified

7935}
7936
7937function insertUpdateIntoFiber(fiber, update) {
7938 ensureUpdateQueues(fiber);
7939 var queue1 = q1;
7940 var queue2 = q2;
7941
7942 // Warn if an update is scheduled from inside an updater function.
7943 {
7944 if ((queue1.isProcessing || queue2 !== null && queue2.isProcessing) && !didWarnUpdateInsideUpdate) {
7945 warning(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
7946 didWarnUpdateInsideUpdate = true;
7947 }
7948 }
7949
7950 // If there's only one queue, add the update to that queue and exit.
7951 if (queue2 === null) {
7952 insertUpdateIntoQueue(queue1, update);
7953 return;
7954 }
7955
7956 // If either queue is empty, we need to add to both queues.
7957 if (queue1.last === null || queue2.last === null) {
7958 insertUpdateIntoQueue(queue1, update);
7959 insertUpdateIntoQueue(queue2, update);
7960 return;
7961 }
7962
7963 // If both lists are not empty, the last update is the same for both lists
7964 // because of structural sharing. So, we should only append to one of
7965 // the lists.
7966 insertUpdateIntoQueue(queue1, update);
7967 // But we still need to update the `last` pointer of queue2.
7968 queue2.last = update;
7969}
7970
7971function getUpdateExpirationTime(fiber) {
7972 switch (fiber.tag) {

Callers 3

ReactFiberClassComponentFunction · 0.70
scheduleCaptureFunction · 0.70
scheduleRootUpdateFunction · 0.70

Calls 3

warningFunction · 0.85
ensureUpdateQueuesFunction · 0.70
insertUpdateIntoQueueFunction · 0.70

Tested by

no test coverage detected