Code RoomOut-of-order async state updates
MediumPrep Room Coding #4202

Out-of-order async state updates

Vibe & agenticConcurrencyMid–Senior~16 min

An AI wrote this React Native screen that subscribes to a native BLE event emitter and updates a heart-rate display. It runs, but the number updates wildly out of order, sometimes flickers backward, and on Android occasionally throws about updating an unmounted component. What's wrong and how would you fix it?

Implement
apply_heart_rate_samples(sample_lines: list[str], unmount_after_index: int) → list[int]
Examples
in[["1000:72","2000:74","3000:73"],100]out[72,74,73]
in[["1000:72","3000:80","2000:60"],100]out[72,80]
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.