Skip to content

UI: Fix double-loading of API data on pages with slow rendering#17357

Merged
Nexucis merged 1 commit intomainfrom
fix-api-double-loading
Oct 17, 2025
Merged

UI: Fix double-loading of API data on pages with slow rendering#17357
Nexucis merged 1 commit intomainfrom
fix-api-double-loading

Conversation

@juliusv
Copy link
Member

@juliusv juliusv commented Oct 17, 2025

Without staleTime: Infinity, the query data would be immediately marked stale, and in combination with the gcTime: 0 setting and a brief unmount during data loading (via Suspense), the data would have to be reloaded a second time during/after the first real render.

gcTime: 0 + staleTime: Infinity should give us the desired behavior where data loaded for a page should be valid forever as long as that page is being displayed, but always thrown away (and later reloaded) whenever we navigate away and again to that page.

Which issue(s) does the PR fix:

Does this PR introduce a user-facing change?

[BUGFIX] UI: Fix duplicate loading of data from the API in some slow-to-render pages

Without `staleTime: Infinity`, the query data would be immediately marked
stale, and in combination with the `gcTime: 0` setting and a brief unmount
during data loading (via Suspense), the data would have to be reloaded a second
time during/after the first real render.

`gcTime: 0` + `staleTime: Infinity` should give us the desired behavior where
data loaded for a page should be valid forever as long as that page is being
displayed, but always thrown away (and later reloaded) whenever we navigate
away and again to that page.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
@juliusv juliusv requested a review from Nexucis October 17, 2025 13:37
Copy link
Member

@Nexucis Nexucis left a comment

Choose a reason for hiding this comment

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

noice

@Nexucis Nexucis merged commit 09e7111 into main Oct 17, 2025
46 checks passed
@Nexucis Nexucis deleted the fix-api-double-loading branch October 17, 2025 15:17
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.

2 participants