2
0

build: 📦️ Update packages

This commit is contained in:
Baptiste Arnaud
2022-04-02 10:38:00 +02:00
parent 525887a32c
commit 05009814d4
22 changed files with 1740 additions and 1629 deletions

View File

@ -1,5 +0,0 @@
import React from 'react'
import { NotFoundPage } from '../layouts/NotFoundPage'
const NotFoundErrorPage = () => <NotFoundPage />
export default NotFoundErrorPage

View File

@ -1,8 +1,17 @@
import NextErrorComponent from 'next/error'
import * as Sentry from '@sentry/nextjs'
import { NextPageContext } from 'next'
const MyError = ({ statusCode, hasGetInitialPropsRun, err }) => {
const MyError = ({
statusCode,
hasGetInitialPropsRun,
err,
}: {
statusCode: number
hasGetInitialPropsRun: boolean
err: Error
}) => {
if (!hasGetInitialPropsRun && err) {
// getInitialProps is not called in case of
// https://github.com/vercel/next.js/issues/8592. As a workaround, we pass
@ -14,13 +23,15 @@ const MyError = ({ statusCode, hasGetInitialPropsRun, err }) => {
return <NextErrorComponent statusCode={statusCode} />
}
MyError.getInitialProps = async (context) => {
MyError.getInitialProps = async (context: NextPageContext) => {
const errorInitialProps = await NextErrorComponent.getInitialProps(context)
const { res, err, asPath } = context
// Workaround for https://github.com/vercel/next.js/issues/8592, mark when
// getInitialProps has run
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
errorInitialProps.hasGetInitialPropsRun = true
// Returning early because we don't want to log 404 errors to Sentry.