Symptom
Staging looked fine. Production "sometimes" showed the wrong filter list after client-side navigation. No consistent repro at first — the worst kind.
What we ruled out (in order)
- API caching — headers looked correct
- React 19 "being React" — tempting, insufficient
- CDN — same bug logged in on VPN off
- Deploy cache — hard refresh did not fix
The actual bug
// Museum exhibit
const onFilter = useCallback(() => {
fetchItems(tenantId);
}, []);
tenantId came from route context on first paint. Client navigated to another tenant without remounting. Handler still closed over the first tenantId.
The fix
const onFilter = useCallback(() => {
fetchItems(tenantId);
}, [tenantId]);
Seven characters. Two hours. Zero AI required.
Why ESLint mattered
react-hooks/exhaustive-deps was yelling the whole time. We had it disabled on that file from an old "quick fix."
Lesson: never silence a rule you do not understand.
Mental model diagram
What we did not do
- Rewrite filters in another framework
- Ask AI to "fix filter bug" without context
- Ship a feature flag for "legacy filter mode"
Checklist for similar bugs
- Repro with navigation, not only full page load
- Log
tenantIdinside handler at click time - Check
useCallback/useMemodeps - Check list
keyprops on route params
TL;DR
Before AI, before rewrites — check closures, keys, and whether the component actually remounted.
From the notebook
Building something? Let's ship it.
MVPs, AI-assisted dev, web & mobile — founder-led team in Delhi. Tell us what you're making.
Keep reading
All articlesExplore Quezt Labs