A card's notes for tonight are sent when the field goes away mid-save (#536) #1035

Merged
claude-bot merged 2 commits from fix/536-tonight-notes-flush-on-unmount into main 2026-10-02 20:56:01 +00:00
Collaborator

Closes #536.

What was wrong

A card's notes for tonight save 1.5 s after the last keystroke, or at once on blur. The field's unmount clean-up cancelled that timer and dropped what it was about to save. So when the field left the page without a blur inside that 1.5 s, the last thing typed was lost: the opened card closing, or the stage moving to another card (the field is keyed by its card). Neither is a page unload, so the unsaved-changes prompt never asked.

What changed

pages/table/TonightNotes.jsx: the clean-up sends a waiting save, to the card it was typed on, and sends nothing when nothing is waiting or the text is back as it was.

Checks

Unit: new TonightNotes.test.jsx, five tests (unmount inside the debounce; a change of card saves to the first card; nothing waiting; typed and put back; the debounce still saves by itself). Full vitest: 3715 passed, 1 skipped. ESLint: 0 errors.

In a browser (local e2e stack built from this branch, 1440×900, as the GM on the table), watching the PATCH that carries tonight_notes:

What was done Result
Typed, then closed the card 300 ms later with no blur one PATCH at 315 ms; kept after reload
Typed on the stage, then the stage moved to card 2 with no blur (spotlight, and "Next card") one PATCH to card 1 at about 310 ms; card 2 untouched; kept after reload
Typed, then left the table by "Leave" 300 ms later one PATCH at 342 ms; kept after reload
Typed and waited one PATCH at 1478 ms; closing afterwards sent nothing more
Typed, then clicked elsewhere one PATCH at 114 ms
Opened and closed without typing; typed "x" then Backspace and closed no PATCH

No console errors or warnings. In practice a real click on "Show less" or another card blurs the field first, which already saved; the lost case needed the field to go without a blur (a keyboard activation, or the stage being moved from elsewhere). The no-blur rows above were driven by script for that reason.

Not checked at phone width: the change has no layout, and the phone table has no notes field of its own.

🤖 Generated with Claude Code

Closes #536. ## What was wrong A card's notes for tonight save 1.5 s after the last keystroke, or at once on blur. The field's unmount clean-up cancelled that timer and dropped what it was about to save. So when the field left the page without a blur inside that 1.5 s, the last thing typed was lost: the opened card closing, or the stage moving to another card (the field is keyed by its card). Neither is a page unload, so the unsaved-changes prompt never asked. ## What changed `pages/table/TonightNotes.jsx`: the clean-up sends a waiting save, to the card it was typed on, and sends nothing when nothing is waiting or the text is back as it was. ## Checks Unit: new `TonightNotes.test.jsx`, five tests (unmount inside the debounce; a change of card saves to the first card; nothing waiting; typed and put back; the debounce still saves by itself). Full vitest: 3715 passed, 1 skipped. ESLint: 0 errors. In a browser (local e2e stack built from this branch, 1440×900, as the GM on the table), watching the PATCH that carries `tonight_notes`: | What was done | Result | |---|---| | Typed, then closed the card 300 ms later with no blur | one PATCH at 315 ms; kept after reload | | Typed on the stage, then the stage moved to card 2 with no blur (spotlight, and "Next card") | one PATCH to card 1 at about 310 ms; card 2 untouched; kept after reload | | Typed, then left the table by "Leave" 300 ms later | one PATCH at 342 ms; kept after reload | | Typed and waited | one PATCH at 1478 ms; closing afterwards sent nothing more | | Typed, then clicked elsewhere | one PATCH at 114 ms | | Opened and closed without typing; typed "x" then Backspace and closed | no PATCH | No console errors or warnings. In practice a real click on "Show less" or another card blurs the field first, which already saved; the lost case needed the field to go without a blur (a keyboard activation, or the stage being moved from elsewhere). The no-blur rows above were driven by script for that reason. Not checked at phone width: the change has no layout, and the phone table has no notes field of its own. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The unmount clean-up cancelled the debounce timer and dropped what it was
about to save. Closing the opened card or the stage moving to another card
(the field is keyed by its card) inside the 1.5 s lost the last thing typed;
neither is a page unload, so beforeunload never asked. The clean-up now sends
it, to the card it was typed on.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Merge remote-tracking branch 'origin/main' into fix/536-tonight-notes-flush-on-unmount
All checks were successful
CI / Backend lint (ruff) (pull_request) Successful in 47s
CI / Does this change touch the recording path? (pull_request) Successful in 41s
CI / Synthetic session harness (no GPU, no LLM) (pull_request) Has been skipped
CI / Bot/backend version sync (pull_request) Successful in 50s
CI / Feedback site tests (pull_request) Successful in 1m7s
CI / Summarisation accuracy eval harness (stub provider) (pull_request) Successful in 1m31s
CI / Bot tests and audit (pull_request) Successful in 2m43s
CI / Docker image build (pull_request) Successful in 3m42s
CI / Frontend (shard 2/2) (pull_request) Successful in 18m46s
CI / Frontend (shard 1/2) (pull_request) Successful in 21m50s
CI / Backend migration, tests, and audit (pull_request) Successful in 46m1s
CI / End-to-end journeys (phone) (pull_request) Successful in 10m57s
CI / End-to-end journeys (keyboard) (pull_request) Successful in 16m32s
CI / End-to-end journeys (desktop) (pull_request) Successful in 16m38s
0b7ef56eb9
Author
Collaborator

CI on 0b7ef56e, run https://git.rhoving.com/rbrooks/Quest-Board/actions/runs/1799 : the three CI / End-to-end journeys jobs (desktop, keyboard, phone) failed before any test ran. The runner ran out of disk while building the journey stack, at 04:57–04:59 UTC:

target fake-ai: failed to solve: failed to extract layer sha256:24f010d1…: write /var/lib/docker/containerd/…: no space left on device
[runner]: copyContent: failed to copy content to container: Error response from daemon: write /run/act/workflow/5: no space left on device

Nothing in this PR causes it. Not re-pushed: once the runner has space, those three jobs want a re-run.

CI on 0b7ef56e, run https://git.rhoving.com/rbrooks/Quest-Board/actions/runs/1799 : the three **CI / End-to-end journeys** jobs (desktop, keyboard, phone) failed before any test ran. The runner ran out of disk while building the journey stack, at 04:57–04:59 UTC: ``` target fake-ai: failed to solve: failed to extract layer sha256:24f010d1…: write /var/lib/docker/containerd/…: no space left on device [runner]: copyContent: failed to copy content to container: Error response from daemon: write /run/act/workflow/5: no space left on device ``` Nothing in this PR causes it. Not re-pushed: once the runner has space, those three jobs want a re-run.
claude-bot deleted branch fix/536-tonight-notes-flush-on-unmount 2026-10-02 20:56:03 +00:00
Sign in to join this conversation.
No description provided.