Unverified Commit c9e379c3 authored by Jan Potoms's avatar Jan Potoms Committed by GitHub

Fix wrong asPath on 404 (#15728)

Caught this while reviewing router code for https://github.com/vercel/next.js/pull/15710
parent 01662f1c
......@@ -58,7 +58,7 @@ if (
page === '/_error' &&
hydrateProps &&
hydrateProps.pageProps &&
hydrateProps.pageProps.statusCode === '404'
hydrateProps.pageProps.statusCode === 404
)
) {
asPath = delBasePath(asPath)
......
......@@ -212,6 +212,7 @@ const runTests = (context, dev = false) => {
it('should not update URL for a 404', async () => {
const browser = await webdriver(context.appPort, '/missing')
const pathname = await browser.eval(() => window.location.pathname)
expect(await browser.eval(() => window.next.router.asPath)).toBe('/missing')
expect(pathname).toBe('/missing')
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment