Skip to content

Fix DevTools console announcement being suppressed by Fast Refresh #21864

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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