Skip to content

Commit

Permalink
fix isNextRouter check in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Mar 21, 2024
1 parent dcc2ab5 commit ce02b7e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/next/src/client/app-index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import { HMR_ACTIONS_SENT_TO_BROWSER } from '../server/dev/hot-reloader-types'
// Since React doesn't call onerror for errors caught in error boundaries.
const origConsoleError = window.console.error
window.console.error = (...args) => {
if (isNextRouterError(args[0])) {
// in dev, the actual error is the second argument.
const error = process.env.NODE_ENV === 'development' ? args[1] : args[0]

if (isNextRouterError(error)) {
return
}
origConsoleError.apply(window.console, args)
Expand Down

0 comments on commit ce02b7e

Please sign in to comment.