Suppress debounced quick-add preview requests for empty input - #351
Merged
Conversation
The htmx debounced trigger (input changed delay:200ms) fired a /quick-add/preview request even after the input was cleared, causing a 400 response that surfaced as a browser console error and made mvp-flow.spec.js flaky. Abort those debounced requests client-side in htmx:beforeRequest while still letting explicit form submits through. Co-authored-by: Hoplite1 <hoplite1@gmx.pw>
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.
Problem
mvp-flow.spec.jsfailed intermittently with an unexpected browser console error:The quick-add form's debounced htmx trigger (
input changed delay:200ms) fires a preview request even when the input has just been cleared (e.g. after submit or fast erase). The backend correctly rejects an empty title with 400, but htmx logs that response as a console error, tripping the test's console-error assertion.Fix
htmx:beforeRequest, abort debounced/quick-add/previewrequests when the quick-add input is empty. Explicit form submits are still allowed through (their 400 is a legitimate server-side validation response), detected via the triggering event type.app.4c78a55.js→app.1e38890.js) and updatedweb/static/manifest.json.No handler, route, or API behavior changes — this only stops a pointless request/console error client-side.
Verification
tests/e2e/quick-add-enter.spec.js: 3 passed per project (chromium, firefox, webkit).tests/e2e/mvp-flow.spec.js+quick-add-enter.spec.json chromium after rebase: 4 passed.go vet ./...clean (no Go changes).