Skip to content

Commit 2585e54

Browse files
authored
Add fetcherKey as parameter to patchRoutesOnNavigation (#13109)
1 parent 4f93036 commit 2585e54

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

.changeset/tokyo-manifest-drift.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@remix-run/router": minor
3+
"react-router": minor
4+
"react-router-dom": minor
5+
---
6+
7+
Add `fetcherKey` as a parameter to `patchRoutesOnNavigation`

packages/router/router.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,7 +2266,8 @@ export function createRouter(init: RouterInit): Router {
22662266
let discoverResult = await discoverRoutes(
22672267
requestMatches,
22682268
new URL(fetchRequest.url).pathname,
2269-
fetchRequest.signal
2269+
fetchRequest.signal,
2270+
key
22702271
);
22712272

22722273
if (discoverResult.type === "aborted") {
@@ -2558,7 +2559,8 @@ export function createRouter(init: RouterInit): Router {
25582559
let discoverResult = await discoverRoutes(
25592560
matches,
25602561
new URL(fetchRequest.url).pathname,
2561-
fetchRequest.signal
2562+
fetchRequest.signal,
2563+
key
25622564
);
25632565

25642566
if (discoverResult.type === "aborted") {
@@ -3281,7 +3283,8 @@ export function createRouter(init: RouterInit): Router {
32813283
async function discoverRoutes(
32823284
matches: AgnosticDataRouteMatch[],
32833285
pathname: string,
3284-
signal: AbortSignal
3286+
signal: AbortSignal,
3287+
fetcherKey?: string
32853288
): Promise<DiscoverRoutesResult> {
32863289
if (!patchRoutesOnNavigationImpl) {
32873290
return { type: "success", matches };
@@ -3297,6 +3300,7 @@ export function createRouter(init: RouterInit): Router {
32973300
signal,
32983301
path: pathname,
32993302
matches: partialMatches,
3303+
fetcherKey,
33003304
patch: (routeId, children) => {
33013305
if (signal.aborted) return;
33023306
patchRoutesImpl(

packages/router/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ export type AgnosticPatchRoutesOnNavigationFunctionArgs<
262262
signal: AbortSignal;
263263
path: string;
264264
matches: M[];
265+
fetcherKey: string | undefined;
265266
patch: (routeId: string | null, children: O[]) => void;
266267
};
267268

0 commit comments

Comments
 (0)