Search hook race condition
An AI wrote this React data-fetching hook for a search box. It updates results as the query changes. Review it for race conditions.
The user reports that results sometimes don't match what they typed. What's happening and how do you fix it?
Implement
applied_search_results(query_lines: list[str], ignore_stale: bool) → list[str]Examples
in
[["c|1","ca|9","cat|1"],false]out["c","cat","ca"]in
[["c|1","ca|9","cat|1"],true]out["c","cat"]What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
0:00 of about 16 min
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.