React incident
Search box typing lag under product-card load
Failure signals
The clues you start with
Overview
What failed in production?
Start by making the bug legible: what the user saw, why it mattered, and what the product was doing underneath.
Symptom
User impact
Environment
Evidence pack
What you can inspect before answering
Real-user timing
Profiler result
Current handler
const onChange = (value: string) => {
setQuery(value);
setResults(expensiveFilter(allItems, value));
fetchSuggestions(value);
};Stage 1: likely root cause
What is most likely causing the lag?
Stage 2: debug priority order
What would you check first? Put the best three at the top.
- #1
Profile a real typing session in React DevTools or the browser Performance panel. See where the time goes before changing the architecture. - #2
Mock the network and measure only the local filter and highlight work. Separate frontend work from request delay. - #3
Throttle CPU and network separately to see which one hurts more. Find out whether the main problem is local work or request delay. - #4
Rewrite the suggestions endpoint before measuring the UI. Big change, weak first step. - #5
Add a debounce immediately and skip profiling. Common fix, but weak if you have not measured first.
Only the top 3 positions are scored.
Expected:
Expected:
Expected:
Stage 3: best fix set
Which fixes should be in the first real patch?
Stage 4: regression guard
What is the best way to catch this kind of regression again?
You started fixing before isolating the bottleneck
Good instincts, but the priorities were not fully clear
You isolated the lag clearly
Ideal runbook
How a strong answer should flow
- 1
Profile the typing interaction before changing architecture. - 2
Separate local render cost from request delay. - 3
Reduce typing-path work first, then cut list rendering and request churn. - 4
Track the delay users actually feel after rollout.
Reflection
Reflection note
What this incident tests
Strong answer signals
You measure before optimizing. You separate slow JavaScript work from slow network. You pick a metric that matches what the user actually feels.