(fiber, update)
| 8186 | } |
| 8187 | |
| 8188 | function insertUpdateIntoFiber(fiber, update) { |
| 8189 | ensureUpdateQueues(fiber); |
| 8190 | var queue1 = q1; |
| 8191 | var queue2 = q2; |
| 8192 | |
| 8193 | // Warn if an update is scheduled from inside an updater function. |
| 8194 | { |
| 8195 | if ((queue1.isProcessing || queue2 !== null && queue2.isProcessing) && !didWarnUpdateInsideUpdate) { |
| 8196 | 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.'); |
| 8197 | didWarnUpdateInsideUpdate = true; |
| 8198 | } |
| 8199 | } |
| 8200 | |
| 8201 | // If there's only one queue, add the update to that queue and exit. |
| 8202 | if (queue2 === null) { |
| 8203 | insertUpdateIntoQueue(queue1, update); |
| 8204 | return; |
| 8205 | } |
| 8206 | |
| 8207 | // If either queue is empty, we need to add to both queues. |
| 8208 | if (queue1.last === null || queue2.last === null) { |
| 8209 | insertUpdateIntoQueue(queue1, update); |
| 8210 | insertUpdateIntoQueue(queue2, update); |
| 8211 | return; |
| 8212 | } |
| 8213 | |
| 8214 | // If both lists are not empty, the last update is the same for both lists |
| 8215 | // because of structural sharing. So, we should only append to one of |
| 8216 | // the lists. |
| 8217 | insertUpdateIntoQueue(queue1, update); |
| 8218 | // But we still need to update the `last` pointer of queue2. |
| 8219 | queue2.last = update; |
| 8220 | } |
| 8221 | |
| 8222 | function getUpdateExpirationTime(fiber) { |
| 8223 | switch (fiber.tag) { |
no test coverage detected