Skip to content

Show a loading indicator while a dandiset search is in flight - #2883

Draft
bendichter wants to merge 1 commit into
masterfrom
search-loading-indicator
Draft

Show a loading indicator while a dandiset search is in flight#2883
bendichter wants to merge 1 commit into
masterfrom
search-loading-indicator

Conversation

@bendichter

Copy link
Copy Markdown
Member

Problem

The dandisets listing gives no feedback while a search is running. The spinner is gated on dandisets being undefined, and the previous response is never cleared when a new request starts, so in practice the spinner appears only on the very first page load. Any search run from an already-populated list leaves the old results sitting on screen, unchanged, until the new response arrives.

That is confusing at any latency and actively misleading at the latency we currently have: the advanced search operators can take upwards of ten seconds, during which the page looks like it has already answered the query. #2882 addresses the slowness itself; this addresses the fact that the remaining wait is invisible.

Change

Track an explicit loading flag rather than inferring it from whether results exist. While a request is in flight:

  • an indeterminate progress bar shows under the toolbar
  • the result count is replaced with "Searching..."
  • stale results stay mounted but are dimmed and non-interactive, so they do not read as the answer to the query being run

Keeping the old results visible rather than blanking the list avoids a full-page content flash on every pagination click, which is the common case and is usually fast.

Out-of-order responses

The same change fixes a latent bug. Requests were not sequenced, so with a slow backend a fast follow-up search could be overwritten by an earlier, slower response landing after it. Requests now carry a monotonic id and only the newest may write results.

While I was in there I also hoisted the request parameters above the first await. They were already read synchronously, so this is not a behavior change, but it makes the watchEffect dependency tracking obvious rather than incidental.

Testing

Frontend type check and lint pass. Verified manually against a local instance: the progress bar and spinner appear for the duration of a slow request and clear when it lands. I first reproduced the original bug by pointing the dev server at the production API, where species:mouse takes about 13 seconds, and confirmed the indicator now covers that whole window.

This is independent of #2882 and touches a different file, so the two can merge in either order.

🤖 Generated with Claude Code

The spinner on the dandisets listing was gated on `dandisets` being
undefined, and the previous response was never cleared when a new request
started. In practice that meant the spinner appeared only on the very
first page load: any subsequent search left the old results on screen
with no indication that anything was happening, which is especially
confusing when the request takes several seconds.

Track an explicit `loading` flag instead. While a request is in flight,
show an indeterminate progress bar under the toolbar, replace the result
count with "Searching...", and dim the stale results so they don't read
as the answer to the query being run.

Also guard against out-of-order responses. Requests carry a monotonic id
and only the newest one may write results, so a slow earlier response can
no longer overwrite a newer one that already returned.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bendichter

Copy link
Copy Markdown
Member Author

old behavior:

Screen.Recording.2026-08-05.at.5.07.33.PM.mov

@bendichter

Copy link
Copy Markdown
Member Author

New behavior:

Screen.Recording.2026-08-05.at.5.06.45.PM.mov

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