Show a loading indicator while a dandiset search is in flight - #2883
Draft
bendichter wants to merge 1 commit into
Draft
Show a loading indicator while a dandiset search is in flight#2883bendichter wants to merge 1 commit into
bendichter wants to merge 1 commit into
Conversation
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>
Member
Author
|
old behavior: Screen.Recording.2026-08-05.at.5.07.33.PM.mov |
Member
Author
|
New behavior: Screen.Recording.2026-08-05.at.5.06.45.PM.mov |
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
The dandisets listing gives no feedback while a search is running. The spinner is gated on
dandisetsbeing 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
loadingflag rather than inferring it from whether results exist. While a request is in flight: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 thewatchEffectdependency 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:mousetakes 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