Starvation Prevention: Ensuring Low Priority Work Completes
What you'll learn: How React ensures that low-priority transition updates eventually finish, even when high-priority updates keep arriving.
The Starvation Problem
When you mark updates as transitions (low priority), React deprioritizes them in favor of urgent user input. But what happens if urgent updates keep flooding in? Without safeguards, your transition work could be interrupted forever—never completing. This is called starvation.
Imagine a restaurant kitchen where VIP orders (urgent updates) always jump the queue. If VIPs keep arriving, regular orders (transitions) would never get cooked. Eventually, you need to serve those regular customers too.
How React Prevents Starvation
React's scheduler implements aging: low-priority work gains importance over time. When a transition update has been interrupted repeatedly or has been waiting too long, React eventually promotes its priority. It stops being interruptible and forces itself to completion.
This happens automatically—you don't configure timeouts or thresholds. React tracks how long work has been pending and ensures it doesn't get abandoned indefinitely.
Why This Matters
Without starvation prevention, scenarios like rapid typing in a search box could permanently delay the expensive filter operation you wrapped in startTransition. The filter would restart on every keystroke but never finish.
With starvation prevention, React guarantees that even if the user keeps typing, the transition will eventually complete—giving them the filtered results they need.
Key Takeaway: React automatically prevents low-priority transition updates from being delayed forever by promoting their priority over time, ensuring all work eventually completes even under heavy urgent update pressure.