-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clientLoader
revalidate even though shouldRevalidate
returns false
#12607
Comments
I have exactly same issue. I think it was fine in RR 7.0 but got broken in 7.1. However, my use case was a little bit different. In RR 7.0, when action failed with error 422 or whatever other 4XX, it didn't revalidate. Now it revalidates. So I thought I will fix it with the |
@timdorr Can you please look into this? 🙏 😸 |
I've just checked code and in deed it shouldn't revalidate on 4XX or 5XX. You can see it here: react-router/packages/react-router/lib/router/router.ts Lines 4219 to 4222 in 79e6bc9
|
@lukejagodzinski according to this doc, it should not revalidate if you throw or return a 4xx/5xx Response. |
I'm using React Router as a...
framework
Reproduction
/main/view
toggle theme
buttonclientLoader
count increaseSystem Info
Used Package Manager
npm
Expected Behavior
As reported in remix-run/remix#10234, single fetch feature introduced an unexpected behavior on
clientLoader
revalidation when usingssr = false
strategy.When a child route's
shouldRevalidate
function returnsfalse
, I expected that this route'sclientLoader
would not be triggered after afetcher
's submission in a parent route.In my example
/
route has afetcher.Form
, that when submitted, should run itsclientAction
and revalidate that route'sclientLoader
, but routes/main
and/main/view
should not be revalidate, since theirshouldRevalidate
function will returnfalse
for that form submission.Actual Behavior
After a
fetcher
submission in a parent route, childclientLoaders
are being revalidated, even though their route'sshouldRevalidate
returns false.In my example, you can check
/main
and/main/view
counters increasing after each action dispatched by the parent route'sfetcher
.The text was updated successfully, but these errors were encountered: