MCPcopy Index your code
hub / github.com/react/react / workLoopConcurrent

Function workLoopConcurrent

packages/react-reconciler/src/ReactFiberWorkLoop.js:2965–2979  ·  view source on GitHub ↗

@noinline

(nonIdle: boolean)

Source from the content-addressed store, hash-verified

2963
2964/** @noinline */
2965function workLoopConcurrent(nonIdle: boolean) {
2966 // We yield every other "frame" when rendering Transition or Retries. Those are blocking
2967 // revealing new content. The purpose of this yield is not to avoid the overhead of yielding,
2968 // which is very low, but rather to intentionally block any frequently occuring other main
2969 // thread work like animations from starving our work. In other words, the purpose of this
2970 // is to reduce the framerate of animations to 30 frames per second.
2971 // For Idle work we yield every 5ms to keep animations going smooth.
2972 if (workInProgress !== null) {
2973 const yieldAfter = now() + (nonIdle ? 25 : 5);
2974 do {
2975 // $FlowFixMe[incompatible-call] flow doesn't know that now() is side-effect free
2976 performUnitOfWork(workInProgress);
2977 } while (workInProgress !== null && now() < yieldAfter);
2978 }
2979}
2980
2981/** @noinline */
2982function workLoopConcurrentByScheduler() {

Callers 1

renderRootConcurrentFunction · 0.85

Calls 2

nowFunction · 0.90
performUnitOfWorkFunction · 0.85

Tested by

no test coverage detected