Skip to content

Show a spinner while a log search runs, and drop stale searches - #290

Merged
drudge merged 2 commits into
mainfrom
claude/query-log-search-debounce
Oct 1, 2026
Merged

drudge merged 2 commits into
mainfrom
claude/query-log-search-debounce

Conversation

@drudge

@drudge drudge commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Searching the query log could feel laggy. The box already waits 400 ms after the last keystroke before it searches, so the lag is the search itself, and the box gave no sign anything was happening.

  • Spinner: a search box whose form is waiting on the server swaps its magnifier for a spinning loader until the answer lands. It holds still under reduced motion. It's in the shared SearchField, so it applies to any search box that posts its own form: both log search boxes and Check a Domain. Boxes that filter in the page never show it.
  • Stale searches dropped: both log search boxes now use hx-sync="this:replace", so a newer search cancels one still on the wire instead of both running.

Checked in the Vandelay demo with the server slowed to 1.5 s: typing ap, then apple cancelled the ap request, the spinner showed while each was out, and the box kept the typed text and focus. TestBrowserLogSearch passes.

Why it's slow

A whole-log search counts every match and then finds the page, scanning the domain, client, and answer of every row. On 1 million rows on an M3 Max it takes about 1.1 s: about 0.75 s for the count and 0.35 s for the page. ns1 keeps 30 days, which could be several million rows, on slower hardware. Speeding that up is a separate change.

Screenshots below (server slowed so the spinner stays up).

Dark Light
Search spinner, dark Search spinner, light

A search of the query log reads the whole stored log, which takes a
second or more on a month of traffic. The box already waited 400 ms
after the last keystroke, but it gave no sign a search was running, and
an older search still on the wire kept going after the next one started.
Now a newer search replaces one still running, in both log search boxes,
and a search box whose form is waiting on the server swaps its magnifier
for a spinner until the answer lands. Under reduced motion it holds
still.
drudge added a commit that referenced this pull request Oct 1, 2026
@drudge
drudge merged commit 9ce0765 into main Oct 1, 2026
4 checks passed
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