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

Fix trailing slash error, upgrade to @primer/components v10 #681

Closed
wants to merge 11 commits into from

Conversation

shawnbot
Copy link
Contributor

This is a workaround for well-known Next.js issue with trailing slashes that cause the server to crash. The redirectTrailingSlash() helper function docs/redirect is a drop-in replacement for the static getInitialProps() method of a custom error handler in pages/_error.js, and redirects if it gets a URL with a trailing slash to the "clean" URL without it.

Or, as I've done in this PR, you can call it in your own getInitialProps(context) (in which context has req, res, and err keys) and extract the props you need for your custom error page.

@emplums maybe this is worth including in our docs components?

@shawnbot shawnbot changed the title Fix trailing slash error Fix trailing slash error, upgrade to @primer/components v10 Feb 19, 2019
@shawnbot shawnbot changed the base branch from release-12.0.0 to master February 19, 2019 21:38
@shawnbot shawnbot changed the base branch from master to release-12.1.0 February 20, 2019 18:17
@shawnbot shawnbot changed the base branch from release-12.1.0 to master February 20, 2019 19:51
Copy link
Contributor

@emplums emplums left a comment

Choose a reason for hiding this comment

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

This looks good to me, can we test it on primer.style/css before merging?

@emplums
Copy link
Contributor

emplums commented Feb 20, 2019

Also! I agree I think it would be great to have in docs-components, I'll add it!

@shawnbot shawnbot changed the base branch from master to release-12.0.1 February 20, 2019 23:26
@shawnbot shawnbot changed the base branch from release-12.0.1 to master February 21, 2019 00:34
@shawnbot shawnbot mentioned this pull request Feb 21, 2019
12 tasks
@shawnbot
Copy link
Contributor Author

Merged locally into #688. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants