Put in order · Vibe coding with Claude Code course · Module 12: Medium clone
Why the agent's autosave stays silent
The agent's version has a setTimeout in a useEffect with the dependency [draft]. Put in order what happens when the captain writes without a pause:
Items to put in order
- The next key arrives before 30 seconds pass, and everything starts again
- The captain presses a key, and draft gets a new value
- React cleans up the previous effect, so clearTimeout deletes the old timer
- The effect sets a new timer for a full 30 seconds
You can check the correct answer by solving this task in the CodeWorlds game.