-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Description
I'm using React Router as a...
framework
Reproduction
- Go to this stackblitz
- On the reproduction browser, navigate to
/main/view
- Click the
toggle theme
button - Check the child
clientLoader
count increase
System Info
System:
OS: macOS 14.6.1
CPU: (8) arm64 Apple M1
Memory: 129.34 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.7 - /usr/local/bin/pnpm
Browsers:
Chrome: 131.0.6778.205
Safari: 17.6
npmPackages:
@react-router/dev: ^7.1.0 => 7.1.0
@react-router/node: ^7.1.0 => 7.1.0
@react-router/serve: ^7.1.0 => 7.1.0
react-router: ^7.1.0 => 7.1.0
vite: ^5.4.11 => 5.4.11
Used Package Manager
npm
Expected Behavior
As reported in remix-run/remix#10234, single fetch feature introduced an unexpected behavior on clientLoader
revalidation when using ssr = false
strategy.
When a child route's shouldRevalidate
function returns false
, I expected that this route's clientLoader
would not be triggered after a fetcher
's submission in a parent route.
In my example /
route has a fetcher.Form
, that when submitted, should run its clientAction
and revalidate that route's clientLoader
, but routes /main
and /main/view
should not be revalidate, since their shouldRevalidate
function will return false
for that form submission.
Actual Behavior
After a fetcher
submission in a parent route, child clientLoaders
are being revalidated, even though their route's shouldRevalidate
returns false.
In my example, you can check /main
and /main/view
counters increasing after each action dispatched by the parent route's fetcher
.