fix: refresh the list of view displays before the views themselves - #649
Merged
Conversation
The page-level "refresh now" set both refreshes going at once: the resource's structure and, over the QueryResults on screen, every view query. Both then ran concurrently on the re-rendered page, and since the structure query is often the slower one it landed last — on the home page 7.2s after every view had already refreshed. Worse, the views it refreshed were the ones on screen at the moment of the click, i.e. the pre-refresh list. When the refreshed structure landed and RefreshingStructurePanel swapped in the rebuilt ViewList, its views were built straight from the cache and no query refresh was issued for them at all, so a view display that had just been added showed whatever the cache happened to hold. The two steps are now sequential. PageTitleMenu only marks the structure and leaves a view-refresh request standing on the resource; isViewRefreshDue(waitsForStructure) hands that request to the first view list built once the refreshed structure has landed, and ViewList marks each view's query as outdated just before building it, so the view comes back through RefreshingResultPanel — what is on screen now, plus a spinner. RefreshingStructurePanel rebuilds its content for a standing request even when the refreshed structure turned out to be the same one, which is what carries the request to the views. Views built outside that structure-driven list — the About and Explore tabs build their own — have no refreshed list to wait for and are still marked right away. A ?root=-pinned space page fetches its view displays inline, so what it shows is already the refreshed list and it does not wait either. forceRefresh now also marks the view-display query itself in ApiCache, the way every other refresh does: without it a forced fetch that finds a refresh of the same query already in flight settles for what that one leaves behind, a response fetched before this refresh was asked for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
The page-level "refresh now" set both refreshes going at once: the resource's structure, and — over the
QueryResults on screen — every view query. Both then ran concurrently on the re-rendered page, and since the structure query is often the slower one it landed last. Home page log, click at20:34:51.749:Worse, the views it refreshed were the ones on screen at the moment of the click, i.e. the pre-refresh list. When the refreshed structure landed and
RefreshingStructurePanelswapped in the rebuiltViewList, its views were built straight from the cache and no query refresh was issued for them at all — so a view display that had just been added showed whatever the cache happened to hold.What this does
The two steps are now sequential: first the list of view displays, then the views that list turns out to contain.
PageTitleMenuonly marks the structure and leaves a view-refresh request standing on the resource, instead of clearing the on-screen views' caches.AbstractResourceWithProfile.isViewRefreshDue(waitsForStructure)hands that request to the first view list built once the refreshed structure has landed. The answer is memoised perRequestCycle, so several lists on one page refresh together rather than the first one taking the request away from the others.ViewListmarks each view's query as outdated just before building it, so the view comes back throughRefreshingResultPanel— what is on screen now, plus a spinner — and swaps in the new results once the query has run.RefreshingStructurePanelrebuilds its content for a standing request even when the refreshed structure turned out to be the same one; that rebuild is what carries the request to the views.forceRefreshnow also marks the view-display query itself inApiCache, the way every other refresh does. Without it, a forced fetch that finds a refresh of the same query already in flight settles for what that one leaves behind — a response fetched before this refresh was asked for.Views built outside the structure-driven list — the About and Explore tabs build their own — have no refreshed list to wait for and are still marked right away (
findParent(ViewList.class) == null). A?root=-pinned space page fetches its view displays inline, so what it shows is already the refreshed list and it does not wait either.Trade-off
The views no longer start refreshing immediately: they wait for the structure query. On the home page that is the ~7 s visible above, with the
StructureRefreshIndicatorspinner running beside the title menu meanwhile. This is deliberate — it is what makes the refreshed list the one whose views get refreshed.Verification
Full suite green (1192 tests), including three new cases in
StructureRefreshTestcovering the wait, the explicit-list path and the no-request default.Driven end-to-end against a local instance. Home page, after the change:
Nothing refreshes between the click and the structure landing. The space page behaves the same; the About tab still refreshes its own nine view queries immediately; pages render clean with no errors.
🤖 Generated with Claude Code