Fiber and the Interruptible Render
Why React rewrote its reconciler around a linked list of units of work, what 'interruptible' actually means on a single thread, and which user-visible behaviours fall out of that decision.
- Level
- RESEARCHER
- Status
- UNDER REVIEW
- Experiments
- 06
- Observations
- 11
Question
JavaScript runs to completion. How can a render be 'interrupted', and what is actually being interrupted?
Background
The pre-Fiber reconciler walked the component tree with recursion. A recursive walk cannot be paused: the state of the traversal lives on the call stack, and you cannot save a call stack. Fiber replaces recursion with an explicit data structure, a tree of fiber nodes linked by child, sibling and return pointers, so the traversal state is a value React owns rather than a stack frame the engine owns.
while (nextUnitOfWork !== null && !shouldYield()) { nextUnitOfWork = performUnitOfWork(nextUnitOfWork);}// shouldYield() consults the scheduler and the frame deadline.// If we yield, nextUnitOfWork is still a valid pointer to resume from.Findings
Finding 1. Only the render phase is interruptible. Render is where your components are called and the work-in-progress tree is built. Commit, where the DOM is mutated and layout effects run, is synchronous and atomic, because a half-applied DOM is not a state the user may ever observe.
Finding 2. Interruptible means abandonable. A render in progress can be thrown away entirely if a higher-priority update arrives. That is why render must be pure: React may call your component twice, or discard the result, and neither may be observable.
Finding 3. Transitions are a priority signal, not a scheduler. startTransition marks an update as non-urgent. It does not make the render faster; it lets an urgent update (a keystroke) pre-empt it, so typing stays responsive while an expensive list re-renders behind it.
Finding 4. Suspense is a coordination mechanism. A component that suspends signals that its subtree is not ready. React keeps the previous UI on screen or shows a fallback, and, with streaming SSR, the server can send the rest of the document while a slow boundary is still resolving.
Interpretation
Everything user-visible in modern React descends from one decision: make the traversal state a value. Concurrent rendering, transitions, Suspense, selective hydration and streaming are all consequences of being able to stop halfway and resume.
Limitations
Fiber internals are not a public API and change between releases. The public contracts, purity of render, the render/commit split, the semantics of transitions and Suspense, are stable and are what this dossier relies on.
References
- 01ReactReact reconciler architecture
- 02React docsstartTransition
- 03React docsSuspense