You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Patch console.error to collect information about hydration errors
@@ -11,42 +17,47 @@ export function patchConsoleError() {
11
17
return
12
18
}
13
19
14
-
window.console.error=(...args: any[])=>{
15
-
letmaybeError: unknown
20
+
constnamedLoggerInstance={
21
+
[NEXT_CONSOLE_STACK_FRAME](...args: any[]){
22
+
letmaybeError: unknown
16
23
17
-
if(process.env.NODE_ENV!=='production'){
18
-
constreplayedError=matchReplayedError(...args)
19
-
if(replayedError){
20
-
maybeError=replayedError
24
+
if(process.env.NODE_ENV!=='production'){
25
+
constreplayedError=matchReplayedError(...args)
26
+
if(replayedError){
27
+
maybeError=replayedError
28
+
}else{
29
+
// See https://github.com/facebook/react/blob/d50323eb845c5fde0d720cae888bf35dedd05506/packages/react-reconciler/src/ReactFiberErrorLogger.js#L78
30
+
maybeError=args[1]
31
+
}
21
32
}else{
22
-
// See https://github.com/facebook/react/blob/d50323eb845c5fde0d720cae888bf35dedd05506/packages/react-reconciler/src/ReactFiberErrorLogger.js#L78
23
-
maybeError=args[1]
33
+
maybeError=args[0]
24
34
}
25
-
}else{
26
-
maybeError=args[0]
27
-
}
28
35
29
-
if(!isNextRouterError(maybeError)){
30
-
if(process.env.NODE_ENV!=='production'){
31
-
// Create an origin stack that pointing to the origin location of the error
32
-
constoriginStack=(newError().stack||'')
33
-
.split('\n')
34
-
// Remove error message and the stack of patched `window.console.error` call
35
-
.slice(2)
36
-
.join('\n')
36
+
if(!isNextRouterError(maybeError)){
37
+
if(process.env.NODE_ENV!=='production'){
38
+
// Create an origin stack that pointing to the origin location of the error
0 commit comments