Summary
Low-priority tasks never run if high-priority work always pending — infinite transition updates starve idle cleanup. Scheduler starvation also on main thread: tight loop blocks microtasks/macrotasks. Yield with setTimeout(0), scheduler.postTask, or break work. Symptom: loading spinner stuck, analytics never fires.
Code example
async function processQueue(tasks) {
for (const task of tasks) {
await new Promise((resolve) => setTimeout(resolve, 0)); // yield macrotask
task();
}
}
Key points
- Low-priority tasks never run if high-priority work always pending — infinite transition updates starve idle cleanup.
- Scheduler starvation also on main thread: tight loop blocks microtasks/macrotasks.
- Yield with
setTimeout(0),scheduler.postTask, or break work. - Symptom: loading spinner stuck, analytics never fires.