Repository navigation
MEA-133: Review: Show pending check-offs and adds, and ignore repeat taps - #204
Merged
Merged
Conversation
On a slow connection the grocery list showed nothing until a change was answered, so people tapped again: the second check-off said "This line was already received" or checked off the line that moved under the finger, and a second Add asked about the line the first one added, so Update doubled it. - +page.svelte: a SvelteSet, `sending`, holds the page's changes on their way, by what sent them: 'add', a store group's key, 'sheet', a line's id for a check-off and `undo-<id>` for an undo. oneAtATime() cancels a form sent again while its key is there; send(), submitPrompt and lineSubmit() all go through it. - A row's circle fills as soon as it's tapped, or empties for an undo, and the row's buttons are disabled until the answer comes. Picking a store under "Where did you get it?" disables the stores the same way. Add reads "Adding…" and stays enabled, so focus stays where it was. - checkOff() remembers the lines the page has sent a check-off for. When checking one off again finds it already received, an earlier tap went through without its answer arriving, so it counts as done: no message, and the list refreshes. A first check-off that finds its line received still says "This line was already received". - src/lib/groceries.ts: ALREADY_RECEIVED, shared by the page and the data layer, which throws it. - design.md 7, Grocery list, and 6.11. No schema change or migration. - Browser tests: the circle and its row while a check-off and an undo are held, a double tap sending one request; the stores disabled under "Where did you get it?"; Add reading "Adding…", with a second tap and Enter sending nothing; and a second tap after a lost answer counting as done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSAcsAw5bkEzyVaBoAn3Sj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements MEA-133.
What changed
On a slow connection, checking off or adding a grocery line now shows progress right away, and a repeat tap while it's on its way does nothing.
src/routes/(app)/groceries/+page.svelteSvelteSet,sending, holds the page's changes in flight, keyed by what sent them:'add'(the add bar and its duplicate or archived question), a store group's key (Mark all),'sheet'(a line's edit sheet), a line's id (checking it off, from its circle or "Where did you get it?") andundo-<id>(undoing that).oneAtATime()cancels a form sent again while its key is there, and clears the key once the result is handled.send(),submitPromptandlineSubmit()all go through it, so each of the page's forms ignores a repeat submit until its result arrives.submitPicker), since the same form stays on the page from one line to the next anduse:enhancedoesn't pick up a new submit function.checkOff()remembers the lines the page has sent a check-off for. When checking one of them off again finds it already received, the earlier tap went through but its answer was lost, so it counts as done: no message, the list refreshes, and "Where did you get it?" closes. A line's first check-off that finds it received, as when someone else checked it off first, still says "This line was already received".src/lib/groceries.ts(new):ALREADY_RECEIVED, shared by the page and the data layer (needs.tsthrows it frommarkReceivedandmarkGotFewer), assrc/lib/menu.tssharesNO_DISHES.docs/design.md: 7, Grocery list (the circle, "Where did you get it?", Add and repeat taps) and 6.11 (a repeat check-off after no answer).Tests
In
tests/e2e/groceries.e2e.ts,slowAction()holds an action's requests, as a slow connection would, until the test answers them, and counts them.I checked that all four new tests fail against
main's grocery page.Assumptions (please check)
Checks
Node 26.13.1, at 792f10f, on the current
main(81b9702):npm run db:generate -- --name ci-schema-check: "No schema changes, nothing to migrate", anddrizzle/unchanged.npm run check: 0 errors, 0 warnings.npm test: 78 files, 1272 tests passed.npm run test:e2eagainst the Docker image built from this branch (E2E_IMAGE), as CI runs it: 321 passed. This container has Chromium build 1243 while Playwright 1.64.1 expects 1248, so I pointedPW_CHROMIUM_PATHat its headless shell, which is what Playwright runs headless; CI installs the right one. (Pointed at the full Chromium instead, two Menu swipe tests, MEA-249, fail here on the finger's offset. They pass with the headless shell.)npm cionly, so it could reach the registry. Nothing else differs, and the run stage is unchanged.Generated by Claude Code