Skip to content

Suppress debounced quick-add preview requests for empty input - #351

Merged
c64bob merged 1 commit into
mainfrom
hoplite/thera-88a75dd8
Aug 4, 2026
Merged

Suppress debounced quick-add preview requests for empty input#351
c64bob merged 1 commit into
mainfrom
hoplite/thera-88a75dd8

Conversation

@usehoplite

@usehoplite usehoplite Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Problem

mvp-flow.spec.js failed intermittently with an unexpected browser console error:

Response Status Error Code 400 from /quick-add/preview

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

  • [[1271:web/assets/app.js]]: in htmx:beforeRequest, abort debounced /quick-add/preview requests 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.
  • Rebuilt the hashed bundle (app.4c78a55.jsapp.1e38890.js) and updated web/static/manifest.json.
  • [[53:tests/e2e/quick-add-enter.spec.js]]: regression test proving a debounced empty-input trigger sends no request while an explicit submit still does.

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.js on chromium after rebase: 4 passed.
  • go vet ./... clean (no Go changes).

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>
@c64bob
c64bob merged commit 10bacee into main Aug 4, 2026
3 checks passed
@c64bob
c64bob deleted the hoplite/thera-88a75dd8 branch August 4, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant