Skip to content

Commit ce02b7e

Browse files
committed
fix isNextRouter check in dev
1 parent dcc2ab5 commit ce02b7e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/next/src/client/app-index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ import { HMR_ACTIONS_SENT_TO_BROWSER } from '../server/dev/hot-reloader-types'
1919
// Since React doesn't call onerror for errors caught in error boundaries.
2020
const origConsoleError = window.console.error
2121
window.console.error = (...args) => {
22-
if (isNextRouterError(args[0])) {
22+
// in dev, the actual error is the second argument.
23+
const error = process.env.NODE_ENV === 'development' ? args[1] : args[0]
24+
25+
if (isNextRouterError(error)) {
2326
return
2427
}
2528
origConsoleError.apply(window.console, args)

0 commit comments

Comments
 (0)