use_loader: loader.loading() is not reactive during background refetch in fullstack routing
Problem
In fullstack mode (use_loader + SSR + client-side routing), the loading indicator
loader.loading() may remain/stay false even while a real request is being executed
and the data is being updated.
This is especially noticeable when navigating back to a previously visited route:
- the request is actually triggered,
- the data is updated after some delay,
- but
loader.loading()does not reflect the loading state.
Since there is no reliable loading indicator, stale data remains visible on the screen during the request, while the UI has no way to indicate that the data is currently being refreshed.
Notably, if any additional reactive signals are present
(for example, a user-defined Signal<bool> that is updated when the request starts and finishes),
loader.loading() begins to behave as expected. This suggests that the issue is specifically related
to the lack of reactive subscription to the loading state, rather than incorrect request execution.
Steps To Reproduce
Steps to reproduce the behavior:
- Open the route
/bug/first(SSR, Suspense works as expected) - Navigate to
/bug/second(client-side navigation,loader.loading()becomestrue) - Navigate back to
/bug/first - Observe that:
- the request is executed (visible via artificial delay and data update),
- the data is updated,
- but
loader.loading()remainsfalsefor the entire duration of the request, causing stale data to remain visible in the UI without any loading indication.
Minimal reproducible example: https://github.com/nerjs/dioxus-bug-loader
Expected behavior
When navigating back and triggering a background data refresh, one of the following should occur:
-
loader.loading()reactively reflects the loading state, - the component transitions back to
Pendingand activatesSuspenseBoundary.fallback, - or there is an explicit and reactive API to detect background loading.
In all cases, the UI should be able to correctly indicate that the currently displayed data is temporarily stale and is being refreshed.
Environment:
- Dioxus version: 0.7.2
- Rust version: 1.91.1 (ed61e7d7e 2025-11-07)
- OS info: Linux 6.8.0-87-generic x86_64 GNU/Linux
- App platform: web (fullstack)
Questionnaire
I would like to fix this and I have a solution.
Additional notes / Possible directions
Below are possible approaches for discussion (not as a requirement):
-
Use the reactive resource state (
resource.state()) instead ofresource.finished()insideloader.loading(), so the loading status becomes reactive and correctly reflects background refreshes. -
Set
loader_state = Pendingwhen a background reload starts, which would re-activateSuspenseBoundary.fallbackand make it useful for client-side navigation in fullstack applications. -
A combination of both approaches.
If the current behavior is considered intentional, it might be worth at least
explicitly documenting that loader.loading() is not a reactive indicator of
background loading and should not be relied upon for UI state.