Skip to content

Commit fbc98d3

Browse files
committed
Merge branch 'dev' into markdalgleish/rsc-framework-mode
2 parents a906e00 + 70abce5 commit fbc98d3

File tree

28 files changed

+405
-228
lines changed

28 files changed

+405
-228
lines changed

.changeset/chilly-needles-taste.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"react-router": patch
3+
---
4+
5+
Update Lazy Route Discovery manifest requests to use a singular comma-separated `paths` query param instead of repeated `p` query params
6+
7+
- This is because Cloudflare has a hard limit of 100 URL search param key/value pairs when used as a key for caching purposes
8+
- If more that 100 paths were included, the cache key would be incomplete and could produce false-positive cache hits

.changeset/honest-bears-pull.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-router": patch
3+
---
4+
5+
Made useOutlet element reference have stable identity in-between route chages

.changeset/silent-emus-grow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-router": patch
3+
---
4+
5+
In RSC Data Mode, handle SSR'd client errors and re-try in the browser

.changeset/sour-crews-destroy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@react-router/dev": patch
3+
---
4+
5+
Switch internal vite plugin Response logic to use `@remix-run/node-fetch-server`

.changeset/yellow-ears-begin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-router": patch
3+
---
4+
5+
Fail gracefully on manifest version mismatch logic if `sessionStorage` access is blocked

contributors.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
- johnpangalos
190190
- jonkoops
191191
- joseph0926
192+
- jplhomer
192193
- jrakotoharisoa
193194
- jrestall
194195
- juanpprieto
@@ -239,6 +240,7 @@
239240
- m-shojaei
240241
- machour
241242
- majamarijan
243+
- Malien
242244
- Manc
243245
- manzano78
244246
- marc2332

docs/api/rsc/RSCStaticRouter.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ routeRSCServerRequest({
4646
fetchServer,
4747
createFromReadableStream,
4848
async renderHTML(getPayload) {
49-
const payload = await getPayload();
49+
const payload = getPayload();
5050

5151
return await renderHTMLToReadableStream(
5252
<RSCStaticRouter getPayload={getPayload} />,
5353
{
5454
bootstrapScriptContent,
55-
formState: await getFormState(payload),
55+
formState: await payload.formState,
5656
}
5757
);
5858
},

docs/api/rsc/routeRSCServerRequest.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ routeRSCServerRequest({
4848
fetchServer,
4949
createFromReadableStream,
5050
async renderHTML(getPayload) {
51-
const payload = await getPayload();
51+
const payload = getPayload();
5252

5353
return await renderHTMLToReadableStream(
5454
<RSCStaticRouter getPayload={getPayload} />,
5555
{
5656
bootstrapScriptContent,
57-
formState: await getFormState(payload),
57+
formState: await payload.formState,
5858
}
5959
);
6060
},
@@ -75,7 +75,7 @@ async function routeRSCServerRequest({
7575
fetchServer: (request: Request) => Promise<Response>;
7676
createFromReadableStream: SSRCreateFromReadableStreamFunction;
7777
renderHTML: (
78-
getPayload: () => Promise<RSCPayload>,
78+
getPayload: () => DecodedPayload,
7979
) => ReadableStream<Uint8Array> | Promise<ReadableStream<Uint8Array>>;
8080
hydrate?: boolean;
8181
}): Promise<Response>

docs/how-to/react-server-components.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -644,17 +644,13 @@ export async function generateHTML(
644644
createFromReadableStream,
645645
// Render the router to HTML.
646646
async renderHTML(getPayload) {
647-
const payload = await getPayload();
648-
const formState =
649-
payload.type === "render"
650-
? await payload.formState
651-
: undefined;
647+
const payload = getPayload();
652648

653649
return await renderHTMLToReadableStream(
654650
<RSCStaticRouter getPayload={getPayload} />,
655651
{
656652
bootstrapScriptContent,
657-
formState,
653+
formState: await payload.formState,
658654
},
659655
);
660656
},
@@ -877,11 +873,7 @@ export async function generateHTML(
877873
createFromReadableStream,
878874
// Render the router to HTML.
879875
async renderHTML(getPayload) {
880-
const payload = await getPayload();
881-
const formState =
882-
payload.type === "render"
883-
? await payload.formState
884-
: undefined;
876+
const payload = getPayload();
885877

886878
const bootstrapScriptContent =
887879
await import.meta.viteRsc.loadBootstrapScriptContent(
@@ -892,7 +884,7 @@ export async function generateHTML(
892884
<RSCStaticRouter getPayload={getPayload} />,
893885
{
894886
bootstrapScriptContent,
895-
formState,
887+
formState: payload.formState,
896888
},
897889
);
898890
},

integration/fog-of-war-test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ test.describe("Fog of War", () => {
715715
expect(await app.getHtml("#parent")).toMatch(`Parent`);
716716
expect(await app.getHtml("#child2")).toMatch(`Child 2`);
717717
expect(manifestRequests).toEqual([
718-
expect.stringMatching(/\/__manifest\?p=%2Fparent%2Fchild2&version=/),
718+
expect.stringMatching(/\/__manifest\?paths=%2Fparent%2Fchild2&version=/),
719719
]);
720720
});
721721

@@ -783,7 +783,7 @@ test.describe("Fog of War", () => {
783783
),
784784
).toEqual(["root", "routes/_index", "routes/$slug"]);
785785
expect(manifestRequests).toEqual([
786-
expect.stringMatching(/\/__manifest\?p=%2Fsomething&version=/),
786+
expect.stringMatching(/\/__manifest\?paths=%2Fsomething&version=/),
787787
]);
788788
manifestRequests = [];
789789

@@ -797,7 +797,7 @@ test.describe("Fog of War", () => {
797797
await page.waitForSelector("#static");
798798
expect(await app.getHtml("#static")).toMatch("Static");
799799
expect(manifestRequests).toEqual([
800-
expect.stringMatching(/\/__manifest\?p=%2Fstatic&version=/),
800+
expect.stringMatching(/\/__manifest\?paths=%2Fstatic&version=/),
801801
]);
802802
expect(
803803
await page.evaluate(() =>
@@ -870,7 +870,7 @@ test.describe("Fog of War", () => {
870870
),
871871
).toEqual(["root", "routes/_index", "routes/$"]);
872872
expect(manifestRequests).toEqual([
873-
expect.stringMatching(/\/__manifest\?p=%2Fsomething&version=/),
873+
expect.stringMatching(/\/__manifest\?paths=%2Fsomething&version=/),
874874
]);
875875
manifestRequests = [];
876876

@@ -884,7 +884,7 @@ test.describe("Fog of War", () => {
884884
await page.waitForSelector("#static");
885885
expect(await app.getHtml("#static")).toMatch("Static");
886886
expect(manifestRequests).toEqual([
887-
expect.stringMatching(/\/__manifest\?p=%2Fstatic&version=/),
887+
expect.stringMatching(/\/__manifest\?paths=%2Fstatic&version=/),
888888
]);
889889
expect(
890890
await page.evaluate(() =>
@@ -956,7 +956,7 @@ test.describe("Fog of War", () => {
956956
await page.waitForSelector("#slug");
957957
expect(await app.getHtml("#slug")).toMatch("Slug: a");
958958
expect(manifestRequests).toEqual([
959-
expect.stringMatching(/\/__manifest\?p=%2Fa&version=/),
959+
expect.stringMatching(/\/__manifest\?paths=%2Fa&version=/),
960960
]);
961961
manifestRequests = [];
962962

@@ -977,7 +977,7 @@ test.describe("Fog of War", () => {
977977
await page.waitForSelector("#slug");
978978
expect(await app.getHtml("#slug")).toMatch("Slug: b");
979979
expect(manifestRequests).toEqual([
980-
expect.stringMatching(/\/__manifest\?p=%2Fb&version=/),
980+
expect.stringMatching(/\/__manifest\?paths=%2Fb&version=/),
981981
]);
982982
});
983983

@@ -1044,7 +1044,7 @@ test.describe("Fog of War", () => {
10441044
await page.waitForSelector("#splat");
10451045
expect(await app.getHtml("#splat")).toMatch("Splat: a");
10461046
expect(manifestRequests).toEqual([
1047-
expect.stringMatching(/\/__manifest\?p=%2Fa&version=/),
1047+
expect.stringMatching(/\/__manifest\?paths=%2Fa&version=/),
10481048
]);
10491049
manifestRequests = [];
10501050

@@ -1065,7 +1065,7 @@ test.describe("Fog of War", () => {
10651065
await page.waitForSelector("#splat");
10661066
expect(await app.getHtml("#splat")).toMatch("Splat: b/c");
10671067
expect(manifestRequests).toEqual([
1068-
expect.stringMatching(/\/__manifest\?p=%2Fb%2Fc&version=/),
1068+
expect.stringMatching(/\/__manifest\?paths=%2Fb%2Fc&version=/),
10691069
]);
10701070
});
10711071

@@ -1137,15 +1137,15 @@ test.describe("Fog of War", () => {
11371137
await app.clickLink("/not/a/path");
11381138
await page.waitForSelector("#error");
11391139
expect(manifestRequests).toEqual([
1140-
expect.stringMatching(/\/__manifest\?p=%2Fnot%2Fa%2Fpath&version=/),
1140+
expect.stringMatching(/\/__manifest\?paths=%2Fnot%2Fa%2Fpath&version=/),
11411141
]);
11421142
manifestRequests = [];
11431143

11441144
// Go to a valid slug route
11451145
await app.clickLink("/something");
11461146
await page.waitForSelector("#slug");
11471147
expect(manifestRequests).toEqual([
1148-
expect.stringMatching(/\/__manifest\?p=%2Fsomething&version=/),
1148+
expect.stringMatching(/\/__manifest\?paths=%2Fsomething&version=/),
11491149
]);
11501150
manifestRequests = [];
11511151

@@ -1233,7 +1233,7 @@ test.describe("Fog of War", () => {
12331233
await new Promise((resolve) => setTimeout(resolve, 250));
12341234
expect(manifestRequests).toEqual([
12351235
expect.stringMatching(
1236-
/\/__manifest\?p=%2F&p=%2Fa&p=%2Fb&version=[a-z0-9]{8}/,
1236+
/\/__manifest\?paths=%2F%2C%2Fa%2C%2Fb&version=[a-z0-9]{8}/,
12371237
),
12381238
]);
12391239
});
@@ -1275,7 +1275,7 @@ test.describe("Fog of War", () => {
12751275
await new Promise((resolve) => setTimeout(resolve, 250));
12761276
expect(manifestRequests).toEqual([
12771277
expect.stringMatching(
1278-
/\/__manifest\?p=%2F&p=%2Fa&p=%2Fb&p=%2Fc&p=%2Fd&p=%2Fe&p=%2Ff&p=%2F/,
1278+
/\/__manifest\?paths=%2F%2C%2Fa%2C%2Fb%2C%2Fc%2C%2Fd%2C%2Fe%2C%2Ff%2C%2Fg/,
12791279
),
12801280
]);
12811281
});
@@ -1439,7 +1439,7 @@ test.describe("Fog of War", () => {
14391439
),
14401440
).toEqual(["root", "routes/_index", "routes/a"]);
14411441
expect(manifestRequests).toEqual([
1442-
expect.stringMatching(/\/custom-manifest\?p=%2F&p=%2Fa&version=/),
1442+
expect.stringMatching(/\/custom-manifest\?paths=%2F%2C%2Fa&version=/),
14431443
]);
14441444
manifestRequests = [];
14451445

@@ -1449,7 +1449,7 @@ test.describe("Fog of War", () => {
14491449
// Wait for eager discovery to kick off
14501450
await new Promise((r) => setTimeout(r, 500));
14511451
expect(manifestRequests).toEqual([
1452-
expect.stringMatching(/\/custom-manifest\?p=%2Fa%2Fb&version=/),
1452+
expect.stringMatching(/\/custom-manifest\?paths=%2Fa%2Fb&version=/),
14531453
]);
14541454

14551455
expect(wrongManifestRequests).toEqual([]);

0 commit comments

Comments
 (0)