After upgrading to v2.2, I noticed that, on production builds, Next is rehydrating the routes for pages that errored during SSR. Steps to reproduce:
import React from 'react'
export default class NewTest extends React.Component {
static async getInitialProps({ res }) {
throw new Error('Test Error');
return {foo: 123};
};
render() {
return <div>
This page should always throw an error: {this.props.foo}
</div>
}
}
Link on client-side. You should see the error page as anticipated.Observations:
render() in the view above.this.props.foo is not filled, leading me to think Next is skipping getInitialProps for initial rehydration purposes, thus missing the error.@arunoda this appears to have been introduced with #1700
@gcpantazis That was a huge change.
Let me check.
I tested. I couldn't reproduce it with 2.2.0

Would you mind sending me a sample repo?
@arunoda that's development-mode, I think? This is only happening on production builds (next build && next start), dev looks fine (like your vid).
Let me know if you can't repro on a production build, I'll put together a repo to demo what I'm seeing if not.
Let me check.
I can reproduce this.
Thanks.
Let's see what we can do about this.
@gcpantazis we'll have the fix in the next patch release.
Thanks @arunoda! assetPrefix is a huge help for us, so this is very much appreciated 馃檱
Most helpful comment
I can reproduce this.
Thanks.
Let's see what we can do about this.