(root, expirationTime, isAsync)
| 14061 | } |
| 14062 | |
| 14063 | function performWorkOnRoot(root, expirationTime, isAsync) { |
| 14064 | !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 14065 | |
| 14066 | isRendering = true; |
| 14067 | |
| 14068 | // Check if this is async work or sync/expired work. |
| 14069 | if (!isAsync) { |
| 14070 | // Flush sync work. |
| 14071 | var finishedWork = root.finishedWork; |
| 14072 | if (finishedWork !== null) { |
| 14073 | // This root is already complete. We can commit it. |
| 14074 | completeRoot(root, finishedWork, expirationTime); |
| 14075 | } else { |
| 14076 | root.finishedWork = null; |
| 14077 | finishedWork = renderRoot(root, expirationTime, false); |
| 14078 | if (finishedWork !== null) { |
| 14079 | // We've completed the root. Commit it. |
| 14080 | completeRoot(root, finishedWork, expirationTime); |
| 14081 | } |
| 14082 | } |
| 14083 | } else { |
| 14084 | // Flush async work. |
| 14085 | var _finishedWork = root.finishedWork; |
| 14086 | if (_finishedWork !== null) { |
| 14087 | // This root is already complete. We can commit it. |
| 14088 | completeRoot(root, _finishedWork, expirationTime); |
| 14089 | } else { |
| 14090 | root.finishedWork = null; |
| 14091 | _finishedWork = renderRoot(root, expirationTime, true); |
| 14092 | if (_finishedWork !== null) { |
| 14093 | // We've completed the root. Check the deadline one more time |
| 14094 | // before committing. |
| 14095 | if (!shouldYield()) { |
| 14096 | // Still time left. Commit the root. |
| 14097 | completeRoot(root, _finishedWork, expirationTime); |
| 14098 | } else { |
| 14099 | // There's no time left. Mark this root as complete. We'll come |
| 14100 | // back and commit it later. |
| 14101 | root.finishedWork = _finishedWork; |
| 14102 | } |
| 14103 | } |
| 14104 | } |
| 14105 | } |
| 14106 | |
| 14107 | isRendering = false; |
| 14108 | } |
| 14109 | |
| 14110 | function completeRoot(root, finishedWork, expirationTime) { |
| 14111 | // Check if there's a batch that matches this expiration time. |
no test coverage detected