-
-
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
fix: Decouple AbortController for revalidating fetchers #10271
Conversation
🦋 Changeset detectedLatest commit: df3ae95 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
"abort", | ||
abortPendingFetchRevalidations | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decouple abort controllers for navigations
abortController.signal.addEventListener( | ||
"abort", | ||
abortPendingFetchRevalidations | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decouple abort controllers for fetcher.submit
revalidations
matches: fetcherMatches, | ||
match: fetcherMatch, | ||
...f, | ||
controller: new AbortController(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every revalidating fetcher now gets it's own AbortController
revalidatingFetchers.push({ key, ...f, matches: null, match: null }); | ||
revalidatingFetchers.push({ | ||
key, | ||
routeId: f.routeId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just to be more explicit about what ends up on the revalidating fetcher obj? Did we spread too much info before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct - no functional change just being more explicit - f
is a FetchLoadMatch
:
interface FetchLoadMatch {
routeId: string;
path: string;
}
interface RevalidatingFetcher extends FetchLoadMatch {
key: string;
match: AgnosticDataRouteMatch | null;
matches: AgnosticDataRouteMatch[] | null;
controller: AbortController | null;
}
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
Fixes a bug where revalidating fetchers share an
AbortController
with the navigation that caused them to revalidate. This introduces a two-way binding when we only want one-way. If the navigation is aborted, then we want the revalidating fetcher to abort. However, if the fetcher is aborted (via unmounting and deleting), it should not impact the navigation.Closes remix-run/remix#5719