(fiber, update)
| 8073 | } |
| 8074 | |
| 8075 | function insertUpdateIntoFiber(fiber, update) { |
| 8076 | ensureUpdateQueues(fiber); |
| 8077 | var queue1 = q1; |
| 8078 | var queue2 = q2; |
| 8079 | |
| 8080 | // Warn if an update is scheduled from inside an updater function. |
| 8081 | { |
| 8082 | if ((queue1.isProcessing || queue2 !== null && queue2.isProcessing) && !didWarnUpdateInsideUpdate) { |
| 8083 | 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.'); |
| 8084 | didWarnUpdateInsideUpdate = true; |
| 8085 | } |
| 8086 | } |
| 8087 | |
| 8088 | // If there's only one queue, add the update to that queue and exit. |
| 8089 | if (queue2 === null) { |
| 8090 | insertUpdateIntoQueue(queue1, update); |
| 8091 | return; |
| 8092 | } |
| 8093 | |
| 8094 | // If either queue is empty, we need to add to both queues. |
| 8095 | if (queue1.last === null || queue2.last === null) { |
| 8096 | insertUpdateIntoQueue(queue1, update); |
| 8097 | insertUpdateIntoQueue(queue2, update); |
| 8098 | return; |
| 8099 | } |
| 8100 | |
| 8101 | // If both lists are not empty, the last update is the same for both lists |
| 8102 | // because of structural sharing. So, we should only append to one of |
| 8103 | // the lists. |
| 8104 | insertUpdateIntoQueue(queue1, update); |
| 8105 | // But we still need to update the `last` pointer of queue2. |
| 8106 | queue2.last = update; |
| 8107 | } |
| 8108 | |
| 8109 | function getUpdateExpirationTime(fiber) { |
| 8110 | switch (fiber.tag) { |
no test coverage detected