[pull] main from remix-run:main - #326
Merged
Merged
Conversation
Signed-off-by: dependabot[bot] <support@github.com>
…revalidation (#15365) * fix(router): drop the reload id when a fetcher action is aborted mid-revalidation `handleFetcherAction` records a `fetchReloadIds` entry once the action resolves and post-action revalidation begins, and deletes it when that revalidation completes. The aborted bail-out sits one line above that delete, so any abort landing in the window leaves the entry behind. An aborted fetcher then goes idle and is pruned from `state.fetchers` by `updateState`, which for a still-mounted fetcher uses a bare Map delete that skips the auxiliary maps. The next `abortStaleFetchLoads` or `markFetchersDone` caller iterates `fetchReloadIds`, finds the orphaned key, and throws `Expected fetcher: <key>`. It surfaces as an unhandled rejection, so no error boundary catches it and the in-flight navigation dies. Moving the delete above the bail-out covers every abort path at once. `fetchControllers` needs no equivalent change: `abortFetcher` deletes from it as part of aborting, so it is self-cleaning on this path, which is why the original code could skip it on the early return. `fetchReloadIds` has no such path — its only other deletion site is `deleteFetcher`. That asymmetry is the bug. The non-aborted path is unchanged: there is no `await` between the line's old and new position, only the `if` test and a `removeEventListener`, neither of which reads `fetchReloadIds`. Adds two tests, both failing before this change: - `submit()` then `load()` on the same key, with no `reset()` involved - `reset()` during post-action revalidation * Updates * Fix fetcher error on navigation with aborted revalidation Clarified the issue with `handleFetcherAction` and its handling of aborted fetchers, which led to unhandled rejections during navigation. --------- Co-authored-by: Matt Brophy <matt@brophy.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )