@samitouri / QOS-React-2 / commits / 9aca239f11

Improved dev experience when DevTools hook is disabled (#20208)

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>

Alphabet Codes committed Nov 11, 2020 at 15:36 UTC 9aca239f11f31109dc1a229aa1571c2bf02f5524
1 file changed +11
packages/react-refresh/src/ReactFreshRuntime.js
+11
@@ -465,6 +465,17 @@ export function injectIntoGlobalHook(globalObject: any): void {
465 };
466 }
467
468 + if (hook.isDisabled) {
469 + // This isn't a real property on the hook, but it can be set to opt out
470 + // of DevTools integration and associated warnings and logs.
471 + // Using console['warn'] to evade Babel and ESLint
472 + console['warn'](
473 + 'Something has shimmed the React DevTools global hook (__REACT_DEVTOOLS_GLOBAL_HOOK__). ' +
474 + 'Fast Refresh is not compatible with this shim and will be disabled.',
475 + );
476 + return;
477 + }
478 +
479 // Here, we just want to get a reference to scheduleRefresh.
480 const oldInject = hook.inject;
481 hook.inject = function(injected) {