(fiber, update)
| 8028 | } |
| 8029 | |
| 8030 | function insertUpdateIntoFiber(fiber, update) { |
| 8031 | ensureUpdateQueues(fiber); |
| 8032 | var queue1 = q1; |
| 8033 | var queue2 = q2; |
| 8034 | |
| 8035 | // Warn if an update is scheduled from inside an updater function. |
| 8036 | { |
| 8037 | if ((queue1.isProcessing || queue2 !== null && queue2.isProcessing) && !didWarnUpdateInsideUpdate) { |
| 8038 | 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.'); |
| 8039 | didWarnUpdateInsideUpdate = true; |
| 8040 | } |
| 8041 | } |
| 8042 | |
| 8043 | // If there's only one queue, add the update to that queue and exit. |
| 8044 | if (queue2 === null) { |
| 8045 | insertUpdateIntoQueue(queue1, update); |
| 8046 | return; |
| 8047 | } |
| 8048 | |
| 8049 | // If either queue is empty, we need to add to both queues. |
| 8050 | if (queue1.last === null || queue2.last === null) { |
| 8051 | insertUpdateIntoQueue(queue1, update); |
| 8052 | insertUpdateIntoQueue(queue2, update); |
| 8053 | return; |
| 8054 | } |
| 8055 | |
| 8056 | // If both lists are not empty, the last update is the same for both lists |
| 8057 | // because of structural sharing. So, we should only append to one of |
| 8058 | // the lists. |
| 8059 | insertUpdateIntoQueue(queue1, update); |
| 8060 | // But we still need to update the `last` pointer of queue2. |
| 8061 | queue2.last = update; |
| 8062 | } |
| 8063 | |
| 8064 | function getUpdateExpirationTime(fiber) { |
| 8065 | switch (fiber.tag) { |
no test coverage detected