Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Sep 18, 2024
1 parent 02428fb commit 6a420aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions integration/vite-prerender-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ test.describe("Prerendering", () => {
let clientDir = path.join(fixture.projectDir, "build", "client");
expect(fs.readdirSync(clientDir).sort()).toEqual([
".vite",
"__manifest",
"_root.data",
"about",
"about.data",
Expand Down Expand Up @@ -178,6 +179,7 @@ test.describe("Prerendering", () => {
let clientDir = path.join(fixture.projectDir, "build", "client");
expect(fs.readdirSync(clientDir).sort()).toEqual([
".vite",
"__manifest",
"_root.data",
"about",
"about.data",
Expand Down
7 changes: 6 additions & 1 deletion packages/react-router/lib/dom/ssr/single-fetch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,15 @@ export function singleFetchUrl(reqUrl: URL | string) {

async function fetchAndDecode(url: URL, init: RequestInit) {
let res = await fetch(url, init);
if (res.status === 404) {

// If this 404'd without hitting the running server (most likely in a
// pre-rendered app using a CDN), then bubble a standard 404 ErrorResponse
if (res.status === 404 && !res.headers.has("X-Remix-Response")) {
throw new ErrorResponseImpl(404, "Not Found", true);
}

invariant(res.body, "No response body to decode");

try {
let decoded = await decodeViaTurboStream(res.body, window);
return { status: res.status, data: decoded.value };
Expand Down

0 comments on commit 6a420aa

Please sign in to comment.