(root, expirationTime, isAsync)
| 13903 | } |
| 13904 | |
| 13905 | function performWorkOnRoot(root, expirationTime, isAsync) { |
| 13906 | !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 13907 | |
| 13908 | isRendering = true; |
| 13909 | |
| 13910 | // Check if this is async work or sync/expired work. |
| 13911 | if (!isAsync) { |
| 13912 | // Flush sync work. |
| 13913 | var finishedWork = root.finishedWork; |
| 13914 | if (finishedWork !== null) { |
| 13915 | // This root is already complete. We can commit it. |
| 13916 | completeRoot(root, finishedWork, expirationTime); |
| 13917 | } else { |
| 13918 | root.finishedWork = null; |
| 13919 | finishedWork = renderRoot(root, expirationTime, false); |
| 13920 | if (finishedWork !== null) { |
| 13921 | // We've completed the root. Commit it. |
| 13922 | completeRoot(root, finishedWork, expirationTime); |
| 13923 | } |
| 13924 | } |
| 13925 | } else { |
| 13926 | // Flush async work. |
| 13927 | var _finishedWork = root.finishedWork; |
| 13928 | if (_finishedWork !== null) { |
| 13929 | // This root is already complete. We can commit it. |
| 13930 | completeRoot(root, _finishedWork, expirationTime); |
| 13931 | } else { |
| 13932 | root.finishedWork = null; |
| 13933 | _finishedWork = renderRoot(root, expirationTime, true); |
| 13934 | if (_finishedWork !== null) { |
| 13935 | // We've completed the root. Check the deadline one more time |
| 13936 | // before committing. |
| 13937 | if (!shouldYield()) { |
| 13938 | // Still time left. Commit the root. |
| 13939 | completeRoot(root, _finishedWork, expirationTime); |
| 13940 | } else { |
| 13941 | // There's no time left. Mark this root as complete. We'll come |
| 13942 | // back and commit it later. |
| 13943 | root.finishedWork = _finishedWork; |
| 13944 | } |
| 13945 | } |
| 13946 | } |
| 13947 | } |
| 13948 | |
| 13949 | isRendering = false; |
| 13950 | } |
| 13951 | |
| 13952 | function completeRoot(root, finishedWork, expirationTime) { |
| 13953 | // Check if there's a batch that matches this expiration time. |
no test coverage detected