(fiber, update)
| 7168 | } |
| 7169 | |
| 7170 | function insertUpdateIntoFiber(fiber, update) { |
| 7171 | ensureUpdateQueues(fiber); |
| 7172 | var queue1 = q1; |
| 7173 | var queue2 = q2; |
| 7174 | |
| 7175 | // Warn if an update is scheduled from inside an updater function. |
| 7176 | { |
| 7177 | if ((queue1.isProcessing || queue2 !== null && queue2.isProcessing) && !didWarnUpdateInsideUpdate) { |
| 7178 | 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.'); |
| 7179 | didWarnUpdateInsideUpdate = true; |
| 7180 | } |
| 7181 | } |
| 7182 | |
| 7183 | // If there's only one queue, add the update to that queue and exit. |
| 7184 | if (queue2 === null) { |
| 7185 | insertUpdateIntoQueue(queue1, update); |
| 7186 | return; |
| 7187 | } |
| 7188 | |
| 7189 | // If either queue is empty, we need to add to both queues. |
| 7190 | if (queue1.last === null || queue2.last === null) { |
| 7191 | insertUpdateIntoQueue(queue1, update); |
| 7192 | insertUpdateIntoQueue(queue2, update); |
| 7193 | return; |
| 7194 | } |
| 7195 | |
| 7196 | // If both lists are not empty, the last update is the same for both lists |
| 7197 | // because of structural sharing. So, we should only append to one of |
| 7198 | // the lists. |
| 7199 | insertUpdateIntoQueue(queue1, update); |
| 7200 | // But we still need to update the `last` pointer of queue2. |
| 7201 | queue2.last = update; |
| 7202 | } |
| 7203 | |
| 7204 | function getUpdateExpirationTime(fiber) { |
| 7205 | switch (fiber.tag) { |
no test coverage detected