Skip to content

Commit f9da912

Browse files
authored
Merge branch 'main' into austinmerrick/upgrade-vercel-nft
2 parents 92335ab + 9d6fb57 commit f9da912

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vercel/remix-builder': patch
3+
---
4+
5+
Update `@remix-run/dev` fork to v2.15.2
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@vercel/next': patch
3+
'vercel': patch
4+
---
5+
6+
Fix bug where when page doesn't postpone it still generates a correct fallback

packages/next/src/utils.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2243,12 +2243,14 @@ export const onPrerenderRoute =
22432243
// If enabled, try to get the postponed route information from the file
22442244
// system and use it to assemble the prerender.
22452245
let postponedPrerender: string | undefined;
2246+
let didPostpone = false;
22462247
if (renderingMode === RenderingMode.PARTIALLY_STATIC && appDir) {
22472248
const htmlPath = path.join(appDir, `${routeFileNoExt}.html`);
22482249
const metaPath = path.join(appDir, `${routeFileNoExt}.meta`);
22492250
if (fs.existsSync(htmlPath) && fs.existsSync(metaPath)) {
22502251
const meta = JSON.parse(await fs.readFile(metaPath, 'utf8'));
22512252
if ('postponed' in meta && typeof meta.postponed === 'string') {
2253+
didPostpone = true;
22522254
postponedPrerender = meta.postponed;
22532255

22542256
// Assign the headers Content-Type header to the prerendered type.
@@ -2259,6 +2261,14 @@ export const onPrerenderRoute =
22592261
// Read the HTML file and append it to the prerendered content.
22602262
const html = await fs.readFileSync(htmlPath, 'utf8');
22612263
postponedPrerender += html;
2264+
} else {
2265+
// Set the content type to text/html; charset=utf-8.
2266+
initialHeaders ??= {};
2267+
initialHeaders['content-type'] = 'text/html; charset=utf-8';
2268+
2269+
// Read the HTML file and set it to the prerendered content.
2270+
const html = await fs.readFileSync(htmlPath, 'utf8');
2271+
postponedPrerender = html;
22622272
}
22632273
}
22642274

@@ -2698,7 +2708,7 @@ export const onPrerenderRoute =
26982708
'content-type': rscContentTypeHeader,
26992709
}
27002710
: {}),
2701-
...(postponedPrerender && rscDidPostponeHeader && !isFallback
2711+
...(didPostpone && rscDidPostponeHeader && !isFallback
27022712
? { [rscDidPostponeHeader]: '1' }
27032713
: {}),
27042714
},
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Page() {
2+
return <p>static page</p>;
3+
}

packages/remix/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@
3939
"semver": "7.5.2",
4040
"vitest": "2.0.1"
4141
},
42-
"VERCEL_REMIX_RUN_DEV_MAX_VERSION": "2.15.1"
42+
"VERCEL_REMIX_RUN_DEV_MAX_VERSION": "2.15.2"
4343
}

0 commit comments

Comments
 (0)