diff --git a/packages/react-devtools-shared/src/backend/renderer.js b/packages/react-devtools-shared/src/backend/renderer.js index e694339687483..506afcedcf36c 100644 --- a/packages/react-devtools-shared/src/backend/renderer.js +++ b/packages/react-devtools-shared/src/backend/renderer.js @@ -2345,6 +2345,18 @@ export function attach( const prevFallbackChildSet = prevFiberChild ? prevFiberChild.sibling : null; + + if (prevFallbackChildSet == null && nextFallbackChildSet != null) { + mountFiberRecursively( + nextFallbackChildSet, + shouldIncludeInTree ? nextFiber : parentFiber, + true, + traceNearestHostComponentUpdate, + ); + + shouldResetChildren = true; + } + if ( nextFallbackChildSet != null && prevFallbackChildSet != null && diff --git a/packages/react-devtools-shared/src/hook.js b/packages/react-devtools-shared/src/hook.js index 39af7daa374ce..4df992e23ea61 100644 --- a/packages/react-devtools-shared/src/hook.js +++ b/packages/react-devtools-shared/src/hook.js @@ -320,7 +320,7 @@ export function installHook(target: any): DevToolsHook | null { let uidCounter = 0; - function inject(renderer: ReactRenderer) { + function inject(renderer: ReactRenderer): number { const id = ++uidCounter; renderers.set(id, renderer); diff --git a/packages/react-reconciler/src/ReactFiberDevToolsHook.js b/packages/react-reconciler/src/ReactFiberDevToolsHook.js index f10806af18803..97de389f3cbc6 100644 --- a/packages/react-reconciler/src/ReactFiberDevToolsHook.js +++ b/packages/react-reconciler/src/ReactFiberDevToolsHook.js @@ -52,10 +52,11 @@ export const isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; export function injectInternals(internals: Object): boolean { - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { + if (!isDevToolsPresent) { // No DevTools return false; } + const hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; if (hook.isDisabled) { // This isn't a real property on the hook, but it can be set to opt out