-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Closed as not planned
Labels
Description
Reproduction
I am using RR v7 in framework mode to build an SPA with clientLoader & clientAction
Wrap any <Outlet/> with <Suspense/> to implement a local loading state which is unique per route.
The main problem is I can safely create a global navigation loader with useNavigation(). But, I fail to create local loaders with Suspense & Await, the navigations are taking place without any loader appearing.
- I am correctly returning axios promises and am making sure that none of the calls are awaited along the way
- The API calls are correctly executing and is being cancelled through
AbortControllerof request.signal inclientLoader
Implementation example:
In the layout
<Suspense fallback={<Loader />}>
<Outlet />
</Suspense><Await resolve={loaderData}>
{(data) => (<></>)}
</Await>export async function clientLoader({
request,
params,
}: Route.ClientLoaderArgs) {
const httpService = new HttpService();
const { organizationId } = params;
const {
skip = 0,
take = 10,
query,
} = Object.fromEntries(new URL(request.url).searchParams.entries());
return httpService.post<IUserPaginatedLoaderData>(
`/organizations/${organizationId}/users/query`,
{
skip,
take,
query,
},
{
signal: request.signal,
},
);
}System Info
System:
OS: macOS 15.6.1
CPU: (8) arm64 Apple M2
Memory: 138.28 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.19.0 - /opt/homebrew/bin/node
npm: 10.9.3 - /opt/homebrew/bin/npm
Browsers:
Chrome: 140.0.7339.133
Safari: 18.6
npmPackages:
@react-router/dev: ^7.8.1 => 7.8.1
@react-router/node: ^7.8.1 => 7.8.1
@react-router/serve: ^7.8.1 => 7.8.1
react-router: ^7.8.1 => 7.8.1
vite: ^6.3.5 => 6.3.5Used Package Manager
npm
Expected Behavior
The local loaders should show while navigating between routes and clientLoader for next route is being called.
Actual Behavior
No loaders are shown at all.