Skip to content

Rule · Performance

Main thread is blocked by long tasks during load

perf/tbt-highwarnvoid perfupdated

Why it matters

Long tasks (>50 ms) make taps and typing unresponsive while the page loads. Total Blocking Time is the lab proxy for INP.

How to fix it

Ship less JavaScript, keep 'use client' at the leaves, defer third-party scripts, and break long work up with scheduler.yield() or setTimeout.

Example

ts
const yieldToMain = () => ('scheduler' in globalThis && 'yield' in scheduler) ? scheduler.yield() : new Promise(r => setTimeout(r, 0));

References

void perf reports 25 rules in this category. Core Web Vitals and bytes: LCP, CLS, TBT, TTFB, JavaScript, CSS, fonts, images, caching and compression, measured as the median of several runs on a throttled mobile and a desktop profile.