diff --git a/packages/react-reconciler/src/ReactFiberDevToolsHook.new.js b/packages/react-reconciler/src/ReactFiberDevToolsHook.new.js index e7bde59e20cba..52d1c68730c61 100644 --- a/packages/react-reconciler/src/ReactFiberDevToolsHook.new.js +++ b/packages/react-reconciler/src/ReactFiberDevToolsHook.new.js @@ -69,8 +69,13 @@ export function injectInternals(internals: Object): boolean { console.error('React instrumentation encountered an error: %s.', err); } } - // DevTools exists - return true; + if (hook.checkDCE) { + // This is the real DevTools. + return true; + } else { + // This is likely a hook installed by Fast Refresh runtime. + return false; + } } export function onScheduleRoot(root: FiberRoot, children: ReactNodeList) { diff --git a/packages/react-reconciler/src/ReactFiberDevToolsHook.old.js b/packages/react-reconciler/src/ReactFiberDevToolsHook.old.js index 494138685e104..42fd68a93a8bc 100644 --- a/packages/react-reconciler/src/ReactFiberDevToolsHook.old.js +++ b/packages/react-reconciler/src/ReactFiberDevToolsHook.old.js @@ -69,8 +69,13 @@ export function injectInternals(internals: Object): boolean { console.error('React instrumentation encountered an error: %s.', err); } } - // DevTools exists - return true; + if (hook.checkDCE) { + // This is the real DevTools. + return true; + } else { + // This is likely a hook installed by Fast Refresh runtime. + return false; + } } export function onScheduleRoot(root: FiberRoot, children: ReactNodeList) {