A search input that stutters, a tab switch that takes 400ms, an INP score stuck in the red — interaction slowness is diagnosed from artifacts: the DevTools long-task flame chart and the React Profiler's commit view. AI is a strong reader of both, turning "something is slow" into a named causal chain you then fix with scheduling, memoization, and transition primitives.
Tier: Advanced · Workflow area: Performance & debugging
This playbook is the interaction-latency counterpart to pb-34's load-time loop: capture the profile, have AI interpret it, fix the top pathology, and re-profile to prove the interaction got faster.
Skip it when the slowness is network-bound (the artifact will show waiting, not work) — fix data fetching first.
react-dom/profiling or your framework's profile mode). Dev builds exaggerate and distort render costs.Capture both artifacts for one scripted interaction. With 4x CPU throttle: record a Performance-panel trace while executing the interaction script, then repeat with the React Profiler recording. From the Performance trace note the interaction's INP breakdown — input delay, processing duration, presentation delay — and the long tasks (>50ms) inside it. From the Profiler note commit count, duration of the worst commits, and which components rendered in them.
Have AI turn the artifacts into a causal chain. Multimodal models read flame-chart and profiler screenshots well; the trace JSON summary or the Profiler's "why did this render" data is even better input:
Attached: (1) the Performance-panel view of one keystroke in our search
filter — processing duration 380ms, one 290ms task; (2) React Profiler
flamegraph for the same keystroke — 3 commits, worst 240ms, 412
components rendered, top self-times listed below.
Produce a causal chain: event -> state update(s) -> which subtrees
re-rendered and why (new props? context? parent render?) -> what work
dominated (render vs effects vs layout). Then name the single highest-
leverage fix and what artifact evidence would confirm it worked.
Demand the chain reference the artifacts ("the 290ms task is dominated by ProductGrid self-time across 300 rows") and reject free-floating advice.
Classify the pathology — the fix follows from the class.
useMemo the computation, virtualize with TanStack Virtual, paginate.useTransition/useDeferredValue so typing stays responsive while results lag gracefully.useLayoutEffect reads force sync layout. Fix: batch reads/writes, CSS containment, move work off the layout path.Apply one fix and re-profile the same script. Same throttle, same interaction, both artifacts again. The claim "memoizing ProductRow fixed it" is confirmed by the Profiler showing rows skipped and the Performance panel showing processing duration under 100ms — not by the code looking right. Memoization that "should work" often doesn't because one prop is still a fresh object; the artifact catches that immediately.
Guard the interaction. Add a regression tripwire: a Playwright test asserting the interaction's responsiveness budget where feasible, React.Profiler onRender logging in development for the hot subtree, and an INP field-data watch. Note the pathology class in the PR so the pattern (not just the instance) enters the team's review vocabulary — pb-28 reviewers should now catch this class in diffs.
Interaction slowness always has an anatomy — event, invalidation scope, dominant work — and it is written in the flame chart and the commit view. AI reads the anatomy fast; only the re-profiled artifact proves the surgery worked.
_printChanges — with the same artifact-first discipline.React.memo with an inline-object prop is a no-op that reads like a fix. The Profiler's "why did this render" answer is the only receipt.useMemo/useCallback adds cost and noise; fix the class the artifact identified — often that is moving one piece of state down, worth fifty memos.useTransition restores responsiveness but the work still burns CPU and battery. If the artifact shows avoidable work, avoid it first, then defer what remains.Profiling artifacts can contain user data (search terms, rendered content in screenshots) and proprietary component names.
Do not profile against production with real user sessions or paste artifacts containing customer data into external tools. Synthetic data reproduces re-render pathologies just as well — the storm is structural, not data-dependent.