Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor 404 and 500 approach #7754

Merged
merged 22 commits into from
Aug 1, 2023
Merged

Refactor 404 and 500 approach #7754

merged 22 commits into from
Aug 1, 2023

Conversation

natemoo-re
Copy link
Member

@natemoo-re natemoo-re commented Jul 21, 2023

Changes

Testing

Tests updated!

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Jul 21, 2023

🦋 Changeset detected

Latest commit: da6d43a

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jul 21, 2023
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach a lot. Great refactor!

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Jul 24, 2023
Copy link
Member Author

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few updates! Moved some tests around, added a couple small fixes

@natemoo-re natemoo-re merged commit 298dbb8 into main Aug 1, 2023
13 checks passed
@natemoo-re natemoo-re deleted the fix/404-prerender branch August 1, 2023 14:52
Comment on lines +268 to +269
* If is a known error code, try sending the according page (e.g. 404.astro / 500.astro).
* This also handles pre-rendered /404 or /500 routes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* If is a known error code, try sending the according page (e.g. 404.astro / 500.astro).
* This also handles pre-rendered /404 or /500 routes
* If it is a known error code, try sending the according page (e.g. 404.astro / 500.astro).
* This also handles pre-rendered /404 or /500 routes

const { status, statusText, headers } = oldResponse;

return new Response(newResponse.body, {
status: status === 200 ? newResponse.status : status,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird; why do we return newRespnose.status if we check the original staus? Can you add a comment?

@ematipico
Copy link
Member

@natemoo-re I left some feedback, could you please address it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants