-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Future v7_fetcherPersist still unmounts before data revalidation is triggered #11101
Comments
This might be a bug with unmounting a fetcher while it's still in the function Component({ unmount }) {
let fetcher = useFetcher();
React.useEffect(() => {
if (fetcher.state === "loading") {
unmount();
}
}, [fetcher.state, unmount]);
return (
<>
<button onClick={() => fetcher.submit({}, { method: "post" })}>
Submit Fetcher
</button>
<pre>Fetcher state: {fetcher.state}</pre>
</>
);
} |
This is resolved by #11102. It missed the cutoff for React Router 6.21.0/Remix 2.4.0 so will be in the next release following those. |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
Reproduction
Create a component that has its own fetcher and unmounts itself, like a
fetcher.submit
on an object that deletes itself from a list upon resolution resulting in an unmount.The request finishes, but data revalidation is not triggered. This is with
navigation: false
.I can confirm this is the case by using an external fetcher and passing it into the component. It then works as expected.
Maybe this is intentional, but it feels a lot less usable in this kind of use case.
System Info
Used Package Manager
pnpm
Expected Behavior
The request would persist the fetcher and trigger data revalidation.
Actual Behavior
It does not trigger data revalidation like it normally would if not unmounted.
The text was updated successfully, but these errors were encountered: