Merged
Conversation
Contributor
|
@nkzawa Is there any recommendation on how to display this error page, in case it's not triggered in For example with Apollo client:
|
Contributor
Author
|
@sedubois You mean to render the error page on custom server ? It would be something like this. res.statusCode = 404
app.renderError(err, req, res, pathname, query)But basically, I think you should use |
Contributor
|
@nkzawa I don't mean custom server, but simply rendering the error page from within a component. Not from componentWillMount() {
if (this.props.XXX === YYY) {
// render error page
}
} |
Contributor
Author
|
@sedubois I think you can just do that on render () {
if (this.props.XXX === YYY) {
return <ErrorPage statusCode={500} />
}
...
} |
Contributor
|
Thanks, that works. I was rather wondering how to render only that component. But that will do for now. |
Closed
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables to import default error page component with
next/error.It's intended to be used for displaying errors occurred on
getInitialPropslike #746 (comment), thanks to @dizlexik for sharing his workaround !Fixes #746