Skip to content
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 shouldRevalidate on fetcher action redirect #9782

Merged
merged 2 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/swift-bottles-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/router": patch
---

Fix fetcher shouldRevalidate
5 changes: 0 additions & 5 deletions packages/router/__tests__/router-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2068,15 +2068,10 @@ describe("a router", () => {
"currentParams": Object {},
"currentUrl": "http://localhost/",
"defaultShouldRevalidate": true,
"formAction": "/fetch",
"formData": FormData {},
"formEncType": "application/x-www-form-urlencoded",
"formMethod": "post",
"nextParams": Object {},
"nextUrl": "http://localhost/",
}
`);
expect(Object.fromEntries(arg.formData)).toEqual({ key: "value" });

router.dispose();
});
Expand Down
3 changes: 1 addition & 2 deletions packages/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,6 @@ export function createRouter(init: RouterInit): Router {
updateState({ fetchers: new Map(state.fetchers) });

return startRedirectNavigation(state, actionResult, {
submission,
isFetchActionRedirect: true,
});
}
Expand Down Expand Up @@ -1512,7 +1511,7 @@ export function createRouter(init: RouterInit): Router {

let redirect = findRedirect(results);
if (redirect) {
return startRedirectNavigation(state, redirect, { submission });
return startRedirectNavigation(state, redirect);
}

// Process and commit output from loaders
Expand Down