File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
packages/nextjs/src/config/templates Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,16 @@ const origGetInitialProps = pageComponent.getInitialProps;
2626const origGetStaticProps = userPageModule . getStaticProps ;
2727const origGetServerSideProps = userPageModule . getServerSideProps ;
2828
29+ const getInitialPropsWrappers : Record < string , any > = {
30+ '/_app' : Sentry . withSentryServerSideAppGetInitialProps ,
31+ '/_document' : Sentry . withSentryServerSideDocumentGetInitialProps ,
32+ '/_error' : Sentry . withSentryServerSideErrorGetInitialProps ,
33+ } ;
34+
35+ const getInitialPropsWrapper = getInitialPropsWrappers [ '__ROUTE__' ] || Sentry . withSentryServerSideGetInitialProps ;
36+
2937if ( typeof origGetInitialProps === 'function' ) {
30- pageComponent . getInitialProps = Sentry . withSentryServerSideGetInitialProps (
31- origGetInitialProps ,
32- '__ROUTE__' ,
33- ) as NextPageComponent [ 'getInitialProps' ] ;
38+ pageComponent . getInitialProps = getInitialPropsWrapper ( origGetInitialProps ) as NextPageComponent [ 'getInitialProps' ] ;
3439}
3540
3641export const getStaticProps =
You can’t perform that action at this time.
0 commit comments