Skip to content

shouldRevalidate does not stop the loader from revalidating #12551

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

Closed
aland-x opened this issue Dec 14, 2024 · 3 comments
Closed

shouldRevalidate does not stop the loader from revalidating #12551

aland-x opened this issue Dec 14, 2024 · 3 comments
Labels

Comments

@aland-x
Copy link

aland-x commented Dec 14, 2024

I'm using React Router as a...

framework

Reproduction

Getting started template modified to add another route and a link for testing purposes with ssr disabled.

https://github.com/aland-x/should-revalidate-test

https://stackblitz.com/github/aland-x/should-revalidate-test

System Info

Not relevant

Used Package Manager

npm

Expected Behavior

When navigating to /test from the link the loader should not revalidate because the shouldRevalidate export is false.

Actual Behavior

When navigating to /test the loader revalidates.

@aland-x aland-x added the bug label Dec 14, 2024
@timdorr
Copy link
Member

timdorr commented Dec 15, 2024

shouldRevalidate doesn't prevent the initial loader call. It's used when the loader might be invalidated after an action call. Hence it takes actionResult as one of its params.

@timdorr timdorr closed this as completed Dec 15, 2024
@aland-x
Copy link
Author

aland-x commented Dec 16, 2024

I'm not talking about the initial load I know that part is not prevented by shouldRevalidate. Also this is an app that was built using remix-spa and I tried to migrate it to rrv7 but noticed this bug.

@aland-x
Copy link
Author

aland-x commented Dec 16, 2024

In the remix version if I set v3_singleFetch to true is has the same behavior as RRv7 now. (shouldRevalidate not work no matter what evne if you pass false)

I'm assuming even when ssr is set to false singeFetch still causes shouldRevalidate to be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants