Skip to content

Commit

Permalink
Restore DevTools console message (#21864)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Jul 13, 2021
1 parent a4ecd85 commit 9f5224a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions packages/react-reconciler/src/ReactFiberDevToolsHook.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 7 additions & 2 deletions packages/react-reconciler/src/ReactFiberDevToolsHook.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9f5224a

Please sign in to comment.