Skip to content

Conversation

@jacbn
Copy link
Contributor

@jacbn jacbn commented Oct 24, 2025

Creates a maintainOnRefetch prop on ShowLoadingQuery that, if set, maintains the old render tree while fetching new data. Also modifies the thenRender function to provide a second parameter, isStale, that can be used anywhere inside the function to e.g. hide certain parts of the page that should never display stale data.

This enables all kinds of new behaviour: show-until-timeout strategies, less jarring loading screens, etc. For now, we make use of this behaviour on revision pages, to maintain the sidebar between page transitions from one revision page to another. We use isStale to hide the page content while stale, so as to give an indication that the page is loading.

@codecov
Copy link

codecov bot commented Oct 24, 2025

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.65%. Comparing base (082ace0) to head (f92c6ed).
⚠️ Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
src/app/components/pages/RevisionDetailPage.tsx 33.33% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1798   +/-   ##
=======================================
  Coverage   41.64%   41.65%           
=======================================
  Files         541      541           
  Lines       23701    23706    +5     
  Branches     7841     7846    +5     
=======================================
+ Hits         9871     9875    +4     
- Misses      13789    13790    +1     
  Partials       41       41           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@axlewin axlewin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all works well, and it'll be nice to start using it in other places too.

On revision pages, it feels slightly jarring that selecting a topic from the overview page still causes the page to scroll right to the top. I can't see a solution for this that doesn't involve some fairly fragile pathname checking in hasPageGroupSpecificScroll, though, which is probably more trouble than it's worth.

@axlewin axlewin merged commit 3e0fafd into main Oct 27, 2025
10 checks passed
@axlewin axlewin deleted the feature/maintain-query-data-on-refetch branch October 27, 2025 14:51
@jacbn
Copy link
Contributor Author

jacbn commented Oct 27, 2025

@axlewin I have been tempted to make the page title the default scroll target for all pages, but it has quite far-reaching consequences so I haven't done it yet. I might try it on a branch and see what it's like?

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.

3 participants