(root, expirationTime, isAsync)
| 13810 | } |
| 13811 | |
| 13812 | function performWorkOnRoot(root, expirationTime, isAsync) { |
| 13813 | !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 13814 | |
| 13815 | isRendering = true; |
| 13816 | |
| 13817 | // Check if this is async work or sync/expired work. |
| 13818 | if (!isAsync) { |
| 13819 | // Flush sync work. |
| 13820 | var finishedWork = root.finishedWork; |
| 13821 | if (finishedWork !== null) { |
| 13822 | // This root is already complete. We can commit it. |
| 13823 | completeRoot(root, finishedWork, expirationTime); |
| 13824 | } else { |
| 13825 | root.finishedWork = null; |
| 13826 | finishedWork = renderRoot(root, expirationTime, false); |
| 13827 | if (finishedWork !== null) { |
| 13828 | // We've completed the root. Commit it. |
| 13829 | completeRoot(root, finishedWork, expirationTime); |
| 13830 | } |
| 13831 | } |
| 13832 | } else { |
| 13833 | // Flush async work. |
| 13834 | var _finishedWork = root.finishedWork; |
| 13835 | if (_finishedWork !== null) { |
| 13836 | // This root is already complete. We can commit it. |
| 13837 | completeRoot(root, _finishedWork, expirationTime); |
| 13838 | } else { |
| 13839 | root.finishedWork = null; |
| 13840 | _finishedWork = renderRoot(root, expirationTime, true); |
| 13841 | if (_finishedWork !== null) { |
| 13842 | // We've completed the root. Check the deadline one more time |
| 13843 | // before committing. |
| 13844 | if (!shouldYield()) { |
| 13845 | // Still time left. Commit the root. |
| 13846 | completeRoot(root, _finishedWork, expirationTime); |
| 13847 | } else { |
| 13848 | // There's no time left. Mark this root as complete. We'll come |
| 13849 | // back and commit it later. |
| 13850 | root.finishedWork = _finishedWork; |
| 13851 | } |
| 13852 | } |
| 13853 | } |
| 13854 | } |
| 13855 | |
| 13856 | isRendering = false; |
| 13857 | } |
| 13858 | |
| 13859 | function completeRoot(root, finishedWork, expirationTime) { |
| 13860 | // Check if there's a batch that matches this expiration time. |
no test coverage detected