Skip to content

Commit 3df673e

Browse files
committed
Rename pattern -> unstable_pattern
1 parent c5aa46e commit 3df673e

File tree

10 files changed

+53
-50
lines changed

10 files changed

+53
-50
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ describe("fetchers", () => {
373373
request: new Request("http://localhost/foo", {
374374
signal: A.loaders.root.stub.mock.calls[0][0].request.signal,
375375
}),
376-
pattern: expect.any(String),
376+
unstable_pattern: expect.any(String),
377377
context: {},
378378
});
379379
});
@@ -3374,7 +3374,7 @@ describe("fetchers", () => {
33743374
expect(F.actions.root.stub).toHaveBeenCalledWith({
33753375
params: {},
33763376
request: expect.any(Request),
3377-
pattern: expect.any(String),
3377+
unstable_pattern: expect.any(String),
33783378
context: {},
33793379
});
33803380

@@ -3404,7 +3404,7 @@ describe("fetchers", () => {
34043404
expect(F.actions.root.stub).toHaveBeenCalledWith({
34053405
params: {},
34063406
request: expect.any(Request),
3407-
pattern: expect.any(String),
3407+
unstable_pattern: expect.any(String),
34083408
context: {},
34093409
});
34103410

@@ -3432,7 +3432,7 @@ describe("fetchers", () => {
34323432
expect(F.actions.root.stub).toHaveBeenCalledWith({
34333433
params: {},
34343434
request: expect.any(Request),
3435-
pattern: expect.any(String),
3435+
unstable_pattern: expect.any(String),
34363436
context: {},
34373437
});
34383438

@@ -3460,7 +3460,7 @@ describe("fetchers", () => {
34603460
expect(F.actions.root.stub).toHaveBeenCalledWith({
34613461
params: {},
34623462
request: expect.any(Request),
3463-
pattern: expect.any(String),
3463+
unstable_pattern: expect.any(String),
34643464
context: {},
34653465
});
34663466

@@ -3489,7 +3489,7 @@ describe("fetchers", () => {
34893489
expect(F.actions.root.stub).toHaveBeenCalledWith({
34903490
params: {},
34913491
request: expect.any(Request),
3492-
pattern: expect.any(String),
3492+
unstable_pattern: expect.any(String),
34933493
context: {},
34943494
});
34953495

@@ -3520,7 +3520,7 @@ describe("fetchers", () => {
35203520
expect(F.actions.root.stub).toHaveBeenCalledWith({
35213521
params: {},
35223522
request: expect.any(Request),
3523-
pattern: expect.any(String),
3523+
unstable_pattern: expect.any(String),
35243524
context: {},
35253525
});
35263526

@@ -3550,7 +3550,7 @@ describe("fetchers", () => {
35503550
expect(F.actions.root.stub).toHaveBeenCalledWith({
35513551
params: {},
35523552
request: expect.any(Request),
3553-
pattern: expect.any(String),
3553+
unstable_pattern: expect.any(String),
35543554
context: {},
35553555
});
35563556

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ describe("instrumentation", () => {
11321132
expect(args.request.headers.get).toBeDefined();
11331133
expect(args.request.headers.set).not.toBeDefined();
11341134
expect(args.params).toEqual({ slug: "a", extra: "extra" });
1135-
expect(args.pattern).toBe("/:slug");
1135+
expect(args.unstable_pattern).toBe("/:slug");
11361136
expect(args.context.get).toBeDefined();
11371137
expect(args.context.set).not.toBeDefined();
11381138
expect(t.router.state.matches[0].params).toEqual({ slug: "a" });
@@ -1663,7 +1663,7 @@ describe("instrumentation", () => {
16631663
},
16641664
},
16651665
params: {},
1666-
pattern: "/",
1666+
unstable_pattern: "/",
16671667
context: {
16681668
get: expect.any(Function),
16691669
},
@@ -1682,7 +1682,7 @@ describe("instrumentation", () => {
16821682
},
16831683
},
16841684
params: {},
1685-
pattern: "/",
1685+
unstable_pattern: "/",
16861686
context: {
16871687
get: expect.any(Function),
16881688
},
@@ -1739,7 +1739,7 @@ describe("instrumentation", () => {
17391739
},
17401740
},
17411741
params: {},
1742-
pattern: "/",
1742+
unstable_pattern: "/",
17431743
context: {
17441744
get: expect.any(Function),
17451745
},
@@ -1757,7 +1757,7 @@ describe("instrumentation", () => {
17571757
},
17581758
},
17591759
params: {},
1760-
pattern: "/",
1760+
unstable_pattern: "/",
17611761
context: {
17621762
get: expect.any(Function),
17631763
},
@@ -1816,7 +1816,7 @@ describe("instrumentation", () => {
18161816
},
18171817
},
18181818
params: {},
1819-
pattern: "/",
1819+
unstable_pattern: "/",
18201820
context: {
18211821
get: expect.any(Function),
18221822
},
@@ -1834,7 +1834,7 @@ describe("instrumentation", () => {
18341834
},
18351835
},
18361836
params: {},
1837-
pattern: "/",
1837+
unstable_pattern: "/",
18381838
context: {
18391839
get: expect.any(Function),
18401840
},

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ describe("a router", () => {
15031503
request: new Request("http://localhost/tasks", {
15041504
signal: nav.loaders.tasks.stub.mock.calls[0][0].request.signal,
15051505
}),
1506-
pattern: "/tasks",
1506+
unstable_pattern: "/tasks",
15071507
context: {},
15081508
});
15091509

@@ -1513,7 +1513,7 @@ describe("a router", () => {
15131513
request: new Request("http://localhost/tasks/1", {
15141514
signal: nav2.loaders.tasksId.stub.mock.calls[0][0].request.signal,
15151515
}),
1516-
pattern: "/tasks/:id",
1516+
unstable_pattern: "/tasks/:id",
15171517
context: {},
15181518
});
15191519

@@ -1523,7 +1523,7 @@ describe("a router", () => {
15231523
request: new Request("http://localhost/tasks?foo=bar", {
15241524
signal: nav3.loaders.tasks.stub.mock.calls[0][0].request.signal,
15251525
}),
1526-
pattern: "/tasks",
1526+
unstable_pattern: "/tasks",
15271527
context: {},
15281528
});
15291529

@@ -1535,7 +1535,7 @@ describe("a router", () => {
15351535
request: new Request("http://localhost/tasks?foo=bar", {
15361536
signal: nav4.loaders.tasks.stub.mock.calls[0][0].request.signal,
15371537
}),
1538-
pattern: "/tasks",
1538+
unstable_pattern: "/tasks",
15391539
context: {},
15401540
});
15411541

@@ -1934,7 +1934,7 @@ describe("a router", () => {
19341934
expect(nav.actions.tasks.stub).toHaveBeenCalledWith({
19351935
params: {},
19361936
request: expect.any(Request),
1937-
pattern: "/tasks",
1937+
unstable_pattern: "/tasks",
19381938
context: {},
19391939
});
19401940

@@ -1979,7 +1979,7 @@ describe("a router", () => {
19791979
expect(nav.actions.tasks.stub).toHaveBeenCalledWith({
19801980
params: {},
19811981
request: expect.any(Request),
1982-
pattern: expect.any(String),
1982+
unstable_pattern: expect.any(String),
19831983
context: {},
19841984
});
19851985
// Assert request internals, cannot do a deep comparison above since some
@@ -2013,7 +2013,7 @@ describe("a router", () => {
20132013
expect(nav.actions.tasks.stub).toHaveBeenCalledWith({
20142014
params: {},
20152015
request: expect.any(Request),
2016-
pattern: expect.any(String),
2016+
unstable_pattern: expect.any(String),
20172017
context: {},
20182018
});
20192019

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ describe("submissions", () => {
948948
expect(nav.actions.root.stub).toHaveBeenCalledWith({
949949
params: {},
950950
request: expect.any(Request),
951-
pattern: expect.any(String),
951+
unstable_pattern: expect.any(String),
952952
context: {},
953953
});
954954

@@ -983,7 +983,7 @@ describe("submissions", () => {
983983
expect(nav.actions.root.stub).toHaveBeenCalledWith({
984984
params: {},
985985
request: expect.any(Request),
986-
pattern: expect.any(String),
986+
unstable_pattern: expect.any(String),
987987
context: {},
988988
});
989989

@@ -1016,7 +1016,7 @@ describe("submissions", () => {
10161016
expect(nav.actions.root.stub).toHaveBeenCalledWith({
10171017
params: {},
10181018
request: expect.any(Request),
1019-
pattern: expect.any(String),
1019+
unstable_pattern: expect.any(String),
10201020
context: {},
10211021
});
10221022

@@ -1121,7 +1121,7 @@ describe("submissions", () => {
11211121
expect(nav.actions.root.stub).toHaveBeenCalledWith({
11221122
params: {},
11231123
request: expect.any(Request),
1124-
pattern: expect.any(String),
1124+
unstable_pattern: expect.any(String),
11251125
context: {},
11261126
});
11271127

@@ -1160,7 +1160,7 @@ describe("submissions", () => {
11601160
expect(nav.actions.root.stub).toHaveBeenCalledWith({
11611161
params: {},
11621162
request: expect.any(Request),
1163-
pattern: expect.any(String),
1163+
unstable_pattern: expect.any(String),
11641164
context: {},
11651165
});
11661166

@@ -1196,7 +1196,7 @@ describe("submissions", () => {
11961196
expect(nav.actions.root.stub).toHaveBeenCalledWith({
11971197
params: {},
11981198
request: expect.any(Request),
1199-
pattern: expect.any(String),
1199+
unstable_pattern: expect.any(String),
12001200
context: {},
12011201
});
12021202

packages/react-router/lib/dom/ssr/routes.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ export function createClientRoutes(
340340
(routeModule.clientLoader?.hydrate === true || !route.hasLoader);
341341

342342
dataRoute.loader = async (
343-
{ request, params, context, pattern }: LoaderFunctionArgs,
343+
{ request, params, context, unstable_pattern }: LoaderFunctionArgs,
344344
singleFetch?: unknown,
345345
) => {
346346
try {
@@ -358,7 +358,7 @@ export function createClientRoutes(
358358
request,
359359
params,
360360
context,
361-
pattern,
361+
unstable_pattern,
362362
async serverLoader() {
363363
preventInvalidServerHandlerCall("loader", route);
364364

@@ -394,7 +394,7 @@ export function createClientRoutes(
394394
);
395395

396396
dataRoute.action = (
397-
{ request, params, context, pattern }: ActionFunctionArgs,
397+
{ request, params, context, unstable_pattern }: ActionFunctionArgs,
398398
singleFetch?: unknown,
399399
) => {
400400
return prefetchStylesAndCallHandler(async () => {
@@ -413,7 +413,7 @@ export function createClientRoutes(
413413
request,
414414
params,
415415
context,
416-
pattern,
416+
unstable_pattern,
417417
async serverAction() {
418418
preventInvalidServerHandlerCall("action", route);
419419
return fetchServerAction(singleFetch);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type RouteHandlerInstrumentationInfo = Readonly<{
6767
headers: Pick<Headers, "get">;
6868
};
6969
params: LoaderFunctionArgs["params"];
70-
pattern: string;
70+
unstable_pattern: string;
7171
// TODO: Fix for non-middleware
7272
context: Pick<RouterContextProvider, "get">;
7373
}>;
@@ -196,7 +196,7 @@ async function recurseRight(
196196
function getInstrumentationInfo(
197197
args: LoaderFunctionArgs,
198198
): RouteHandlerInstrumentationInfo {
199-
let { request, context, params, pattern } = args;
199+
let { request, context, params, unstable_pattern } = args;
200200
return {
201201
// pseudo "Request" with the info they may want to read from
202202
request: {
@@ -208,7 +208,7 @@ function getInstrumentationInfo(
208208
},
209209
},
210210
params: { ...params },
211-
pattern,
211+
unstable_pattern,
212212
context: {
213213
get: (...args: Parameters<RouterContextProvider["get"]>) =>
214214
context.get(...args),

0 commit comments

Comments
 (0)