Skip to content

Commit

Permalink
Restore DevTools console message (facebook#21864)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored and zhengjitf committed Apr 15, 2022
1 parent 08ccbdf commit ccfc71e
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 ccfc71e

Please sign in to comment.