mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
In minimal mode, if there was `/[slug].js` with `notFound: true` on the same segment of `_error.js`, `req.url` and `ctx.asPath` were returned as `/[slug]`, since it was re-initialized to the request url. Therefore, don't re-initialize the URL if it is in minimal mode && is the `_error` page. Fixes NEXT-4660 --------- Co-authored-by: JJ Kasper <[email protected]>
23 lines
338 B
TypeScript
23 lines
338 B
TypeScript
import type { NextPageContext } from 'next'
|
|
|
|
Error.getInitialProps = (ctx: NextPageContext) => {
|
|
return {
|
|
reqUrl: ctx.req?.url,
|
|
asPath: ctx.asPath,
|
|
}
|
|
}
|
|
|
|
export default function Error({
|
|
reqUrl,
|
|
asPath,
|
|
}: {
|
|
reqUrl?: string
|
|
asPath?: string
|
|
}) {
|
|
return (
|
|
<p>
|
|
reqUrl: {reqUrl}, asPath: {asPath}
|
|
</p>
|
|
)
|
|
}
|