Why is loader not fetch at the same time as the lazy load?
I've split my routes like this:
src/routes/category/$.tsx
-> has the loader and validateSearch
src/routes/category/$.lazy.tsx
-> only the component
When I hover over a link to a category page, I see this in the network tab (check the image).
It looks like the lazy-loaded content is fetched first, and then, once that's done, it fetches the loader resources. My question is: since I have my loader in the non-lazy route, shouldn't TanStack Router start fetching those resources right away? Am I missing a setting to make that happen? Thanks!
3 Replies
fair-rose•12mo ago
this is fixed now in https://github.com/TanStack/router/releases/tag/v1.58.2
GitHub
Release v1.58.2 · TanStack/router
Version 1.58.2 - 9/18/24, 9:46 PM
Changes
Fix
react-router: kick off loader early (#2368) (4e6e66f) by Manuel Schiller
Packages
@tanstack/react-router@1.58.2
@tanstack/react-router-with-query@1....
fair-rose•12mo ago
please try again
rare-sapphireOP•12mo ago
Thank you! ill check when i get home!