Skip to content

Commit d8c54bc

Browse files
committed
Updates
1 parent 5b52c72 commit d8c54bc

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

packages/react-router/__tests__/router/revalidate-test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,12 @@ describe("router.revalidate", () => {
11121112
revalidation: "idle",
11131113
loaderData: { root: "ROOT**" },
11141114
});
1115+
// The interrupted revalidation hooks into the next completed navigation
1116+
// so it reflects the end state value
11151117
expect(revalidationValue).toBe("ROOT**");
1116-
expect(navigationValue).toBe("ROOT**");
1118+
// The interim navigation gets interrupted and ends while the router still
1119+
// reflects the original value
1120+
expect(navigationValue).toBe("ROOT");
11171121
expect(navigationValue2).toBe("ROOT**");
11181122

11191123
// no-op
@@ -1126,7 +1130,7 @@ describe("router.revalidate", () => {
11261130
loaderData: { root: "ROOT**" },
11271131
});
11281132
expect(revalidationValue).toBe("ROOT**");
1129-
expect(navigationValue).toBe("ROOT**");
1133+
expect(navigationValue).toBe("ROOT");
11301134
expect(navigationValue2).toBe("ROOT**");
11311135
});
11321136
});

packages/react-router/lib/router/router.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2864,10 +2864,12 @@ export function createRouter(init: RouterInit): Router {
28642864
return dataResults;
28652865
}
28662866

2867+
if (request.signal.aborted) {
2868+
return dataResults;
2869+
}
2870+
28672871
for (let [routeId, result] of Object.entries(results)) {
2868-
if (!result) {
2869-
dataResults[routeId] = { type: ResultType.error, error: result };
2870-
} else if (isRedirectDataStrategyResult(result)) {
2872+
if (isRedirectDataStrategyResult(result)) {
28712873
let response = result.result as Response;
28722874
dataResults[routeId] = {
28732875
type: ResultType.redirect,

0 commit comments

Comments
 (0)