(root, expirationTime, isAsync)
| 13043 | } |
| 13044 | |
| 13045 | function performWorkOnRoot(root, expirationTime, isAsync) { |
| 13046 | !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 13047 | |
| 13048 | isRendering = true; |
| 13049 | |
| 13050 | // Check if this is async work or sync/expired work. |
| 13051 | if (!isAsync) { |
| 13052 | // Flush sync work. |
| 13053 | var finishedWork = root.finishedWork; |
| 13054 | if (finishedWork !== null) { |
| 13055 | // This root is already complete. We can commit it. |
| 13056 | completeRoot(root, finishedWork, expirationTime); |
| 13057 | } else { |
| 13058 | root.finishedWork = null; |
| 13059 | finishedWork = renderRoot(root, expirationTime, false); |
| 13060 | if (finishedWork !== null) { |
| 13061 | // We've completed the root. Commit it. |
| 13062 | completeRoot(root, finishedWork, expirationTime); |
| 13063 | } |
| 13064 | } |
| 13065 | } else { |
| 13066 | // Flush async work. |
| 13067 | var _finishedWork = root.finishedWork; |
| 13068 | if (_finishedWork !== null) { |
| 13069 | // This root is already complete. We can commit it. |
| 13070 | completeRoot(root, _finishedWork, expirationTime); |
| 13071 | } else { |
| 13072 | root.finishedWork = null; |
| 13073 | _finishedWork = renderRoot(root, expirationTime, true); |
| 13074 | if (_finishedWork !== null) { |
| 13075 | // We've completed the root. Check the deadline one more time |
| 13076 | // before committing. |
| 13077 | if (!shouldYield()) { |
| 13078 | // Still time left. Commit the root. |
| 13079 | completeRoot(root, _finishedWork, expirationTime); |
| 13080 | } else { |
| 13081 | // There's no time left. Mark this root as complete. We'll come |
| 13082 | // back and commit it later. |
| 13083 | root.finishedWork = _finishedWork; |
| 13084 | } |
| 13085 | } |
| 13086 | } |
| 13087 | } |
| 13088 | |
| 13089 | isRendering = false; |
| 13090 | } |
| 13091 | |
| 13092 | function completeRoot(root, finishedWork, expirationTime) { |
| 13093 | // Check if there's a batch that matches this expiration time. |
no test coverage detected