Skip to content

Commit 9f5224a

Browse files
authored
Restore DevTools console message (#21864)
1 parent a4ecd85 commit 9f5224a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

packages/react-reconciler/src/ReactFiberDevToolsHook.new.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ export function injectInternals(internals: Object): boolean {
6969
console.error('React instrumentation encountered an error: %s.', err);
7070
}
7171
}
72-
// DevTools exists
73-
return true;
72+
if (hook.checkDCE) {
73+
// This is the real DevTools.
74+
return true;
75+
} else {
76+
// This is likely a hook installed by Fast Refresh runtime.
77+
return false;
78+
}
7479
}
7580

7681
export function onScheduleRoot(root: FiberRoot, children: ReactNodeList) {

packages/react-reconciler/src/ReactFiberDevToolsHook.old.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ export function injectInternals(internals: Object): boolean {
6969
console.error('React instrumentation encountered an error: %s.', err);
7070
}
7171
}
72-
// DevTools exists
73-
return true;
72+
if (hook.checkDCE) {
73+
// This is the real DevTools.
74+
return true;
75+
} else {
76+
// This is likely a hook installed by Fast Refresh runtime.
77+
return false;
78+
}
7479
}
7580

7681
export function onScheduleRoot(root: FiberRoot, children: ReactNodeList) {

0 commit comments

Comments
 (0)