-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
- Loading branch information
1 parent
5b4b782
commit 097a8e4
Showing
16 changed files
with
221 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"astro": patch | ||
--- | ||
|
||
Fix a handful of edge cases with prerendered 404/500 pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
.../test/fixtures/prerender-404/package.json → ...t/fixtures/prerender-404-500/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/integrations/node/test/fixtures/prerender-404-500/src/external-stylesheet.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
background-color: ivory; | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/integrations/node/test/fixtures/prerender-404-500/src/nondeterminism-404.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// This module is only used by the prerendered 404.astro. | ||
// It exhibits different behavior if it's called more than once, | ||
// which is detected by a test and interpreted as a failure. | ||
|
||
let usedOnce = false | ||
let dynamicMessage = "Page was not prerendered" | ||
|
||
export default function () { | ||
if (usedOnce === false) { | ||
usedOnce = true | ||
return "Page does not exist" | ||
} | ||
|
||
dynamicMessage += "+" | ||
|
||
return dynamicMessage | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/integrations/node/test/fixtures/prerender-404-500/src/nondeterminism-500.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// This module is only used by the prerendered 500.astro. | ||
// It exhibits different behavior if it's called more than once, | ||
// which is detected by a test and interpreted as a failure. | ||
|
||
let usedOnce = false | ||
let dynamicMessage = "Page was not prerendered" | ||
|
||
export default function () { | ||
if (usedOnce === false) { | ||
usedOnce = true | ||
return "Something went wrong" | ||
} | ||
|
||
dynamicMessage += "+" | ||
|
||
return dynamicMessage | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/integrations/node/test/fixtures/prerender-404-500/src/pages/404.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
import message from "../nondeterminism-404" | ||
export const prerender = true; | ||
--- | ||
{message()} |
6 changes: 6 additions & 0 deletions
6
packages/integrations/node/test/fixtures/prerender-404-500/src/pages/500.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
import "../external-stylesheet.css" | ||
import message from "../nondeterminism-500" | ||
export const prerender = true | ||
--- | ||
<h1>{message()}</h1> |
4 changes: 4 additions & 0 deletions
4
packages/integrations/node/test/fixtures/prerender-404-500/src/pages/fivehundred.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
return new Response(null, { status: 500 }) | ||
--- | ||
<p>This html will not be served</p> |
File renamed without changes.
5 changes: 0 additions & 5 deletions
5
packages/integrations/node/test/fixtures/prerender-404/src/pages/404.astro
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.