(root, expirationTime, isAsync)
| 13171 | } |
| 13172 | |
| 13173 | function performWorkOnRoot(root, expirationTime, isAsync) { |
| 13174 | !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 13175 | |
| 13176 | isRendering = true; |
| 13177 | |
| 13178 | // Check if this is async work or sync/expired work. |
| 13179 | if (!isAsync) { |
| 13180 | // Flush sync work. |
| 13181 | var finishedWork = root.finishedWork; |
| 13182 | if (finishedWork !== null) { |
| 13183 | // This root is already complete. We can commit it. |
| 13184 | completeRoot(root, finishedWork, expirationTime); |
| 13185 | } else { |
| 13186 | root.finishedWork = null; |
| 13187 | finishedWork = renderRoot(root, expirationTime, false); |
| 13188 | if (finishedWork !== null) { |
| 13189 | // We've completed the root. Commit it. |
| 13190 | completeRoot(root, finishedWork, expirationTime); |
| 13191 | } |
| 13192 | } |
| 13193 | } else { |
| 13194 | // Flush async work. |
| 13195 | var _finishedWork = root.finishedWork; |
| 13196 | if (_finishedWork !== null) { |
| 13197 | // This root is already complete. We can commit it. |
| 13198 | completeRoot(root, _finishedWork, expirationTime); |
| 13199 | } else { |
| 13200 | root.finishedWork = null; |
| 13201 | _finishedWork = renderRoot(root, expirationTime, true); |
| 13202 | if (_finishedWork !== null) { |
| 13203 | // We've completed the root. Check the deadline one more time |
| 13204 | // before committing. |
| 13205 | if (!shouldYield()) { |
| 13206 | // Still time left. Commit the root. |
| 13207 | completeRoot(root, _finishedWork, expirationTime); |
| 13208 | } else { |
| 13209 | // There's no time left. Mark this root as complete. We'll come |
| 13210 | // back and commit it later. |
| 13211 | root.finishedWork = _finishedWork; |
| 13212 | } |
| 13213 | } |
| 13214 | } |
| 13215 | } |
| 13216 | |
| 13217 | isRendering = false; |
| 13218 | } |
| 13219 | |
| 13220 | function completeRoot(root, finishedWork, expirationTime) { |
| 13221 | // Check if there's a batch that matches this expiration time. |
no test coverage detected