.agents/skills/debug-frontend-with-browser/references/pitfalls.md
Read this only after the mandatory agent-testing workflow has selected and
approved an isolated execution surface.
Keep-alive routers, Activities, portals, and background tabs can retain multiple component trees. Several stores can contain the same entity while the visible tab owns another store.
For every candidate store, compare a structural summary:
Do not treat the first matching Fiber as authoritative. Prefer the project's
state probe or React DevTools. Use targeted Fiber inspection only as a fallback,
and serialize copied values immediately with JSON.stringify(value, null, 2).
A virtualized list can retain an item in its data source while its DOM row is offscreen or recycled. Compare raw records, derived records, virtual-list IDs, and visible rows separately.
Capture the state immediately before the action, after the optimistic update, after server reconciliation, and after a remount. A correct optimistic frame does not prove that the authoritative cache was updated.
Refresh changes the React root, viewport, optimistic buffers, in-memory cache, and revalidation timing. Reinspect the underlying state after refresh; a visually correct final frame does not explain an earlier stale frame.
Treat each cache boundary as a separate owner:
For a mutation followed by navigation, record this exact timeline:
If a stale item appears only after remount and disappears after revalidation, compare the mutation's local store update with the query cache under the same key. A mutation that updates Zustand but leaves SWR unchanged can be overwritten when the remounted fetch hook hydrates Zustand from the stale SWR entry.
Do not prove this by manually injecting storage into a production client. Seed the server-side fixture and client cache state inside the approved isolated environment, then observe the real application lifecycle.
Project structure rather than private content. IDs, types or roles, parent links, timestamps, branch metadata, cache keys, and tool linkage are usually sufficient.
When an exact browser input reproduces in a local pure function, Electron, React, Zustand, and the virtual list are no longer required to explain that boundary. Fix and test the pure transformation.
Shallow or grafted repositories can hide intermediate commits. Before naming a first-bad PR:
Compare the first bad code revision, trigger-data creation time, and deployment time. A recent data event can expose an older latent defect; it does not make the newest PR causal.