-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[Bug]: Can we check shouldRevalidation before we cancel a loader? #12007
Comments
Does this happen if you are using separate fetchers for |
@brophdawg11 sorry, there is a typo. I am using separate fetchers for load and submit. |
Hi! Is anybody working on this issue? If not, I'd like to give it a try.
The problem is solved if we simply don't interruptActiveLoads and check if a loader is still in process before revalidating it. That way some loaders could even be resolved before the action finishes in an async manner. The questions I have are about, considering these changes, how do we manage redirections? assume the This really got my interest; I'll like to send a PR (draft) to address this problem more closely. |
@brophdawg11 Hi, do you have any feedback? |
What version of React Router are you using?
6.26.2
Steps to Reproduce
When we have code like this. When the component mount, the action submission will cancel the loader. After the action excution, the loader will run again because of revalidation. So we will fetch
/api
twice.Expected Behavior
I think you need to check the
shouldRevalidate
function before cancel a loader, because if the loader don't need to revalidate when this action submit, cancellations are pointless and lead to repeated execution.Actual Behavior
The loader repeats.
The text was updated successfully, but these errors were encountered: