test(webapp): a quantity and a removal may go in two saves (#1221) #1290
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/1221-sheet-removal-save"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #1221.
It was the test, not the sheet. Autosave is debounced 800 ms (
DEBOUNCE,editState.js). Under CI load,userEvent.clickon Remove can take longer than that, so the quantity goes in save 1 and the removal in save 2. The test read onlymock.calls[0], found no removal, and failed.No data is lost:
useSheetEditor.save()snapshots the draft assent.saveOkthen applieswithout(draft, sent), whosekeep()keeps every key that wasn't in that save or has changed since. So a removal made during or after a save stays indraft.entries(null), and the debounce saves it next, on the new version. Verified by reading the code, not just the agent's report.Changes (test only):
patchSheetcall and requires the union of updates and removals, plus theexpected_versionchain.remove: ["inv-rope"]onversion + 1.Checked: both tests 30 times in separate runs, all passed.
src/pages/sheet: 254 tests passed. eslint is clean. No changelog fragment, since nothing users see changed.🤖 Generated with Claude Code