-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Description
Reproduction
Reproduction repo: https://github.com/rossipedia/rr-data-req-loaders-shenanigans
Instructions are in the README, but I've duplicated them here:
Reproduction steps:
Start this application with npm run dev
Execute the following request via curl:
$ curl 'localhost:5173/fooYou should see the following output in the server terminal:
root loader
layout loader
foo loader
Now run the following curl command to send a RR Data request for the routes/foo route only:
$ curl 'localhost:5173/foo.data?_routes=routes%2Ffoo'
You will notice that you still see
root loader
layout loader
foo loader
This is the bug.
When requesting data for a specific set of routes, only those route loaders should execute.
Instead, all the matched route loaders are invoked, based on the request's pathname, and the _routes parameter is ignored.
System Info
System:
OS: macOS 15.6.1
CPU: (16) arm64 Apple M4 Max
Memory: 7.30 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.15.1 - ~/.local/state/fnm_multishells/3342_1756931003739/bin/node
Yarn: 4.9.1 - ~/.local/state/fnm_multishells/3342_1756931003739/bin/yarn
npm: 10.9.2 - ~/.local/state/fnm_multishells/3342_1756931003739/bin/npm
bun: 1.2.21 - /opt/homebrew/bin/bun
Browsers:
Chrome: 139.0.7258.155
Edge: 139.0.3405.119
Safari: 18.6Used Package Manager
npm
Expected Behavior
I expect the loaders for only the specified routes to be run.
Actual Behavior
All loaders for all matched routes based on pathname are run, and the _routes param is ignored.