Skip to content

Commit 3d94214

Browse files
committed
fix[devtools/updateFiberRecursively]: mount suspense fallback set in timed-out case
1 parent 587ae49 commit 3d94214

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

packages/react-devtools-shared/src/backend/renderer.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,6 +2345,18 @@ export function attach(
23452345
const prevFallbackChildSet = prevFiberChild
23462346
? prevFiberChild.sibling
23472347
: null;
2348+
2349+
if (prevFallbackChildSet == null && nextFallbackChildSet != null) {
2350+
mountFiberRecursively(
2351+
nextFallbackChildSet,
2352+
shouldIncludeInTree ? nextFiber : parentFiber,
2353+
true,
2354+
traceNearestHostComponentUpdate,
2355+
);
2356+
2357+
shouldResetChildren = true;
2358+
}
2359+
23482360
if (
23492361
nextFallbackChildSet != null &&
23502362
prevFallbackChildSet != null &&

packages/react-devtools-shared/src/hook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export function installHook(target: any): DevToolsHook | null {
320320

321321
let uidCounter = 0;
322322

323-
function inject(renderer: ReactRenderer) {
323+
function inject(renderer: ReactRenderer): number {
324324
const id = ++uidCounter;
325325
renderers.set(id, renderer);
326326

packages/react-reconciler/src/ReactFiberDevToolsHook.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ export const isDevToolsPresent =
5252
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
5353

5454
export function injectInternals(internals: Object): boolean {
55-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
55+
if (!isDevToolsPresent) {
5656
// No DevTools
5757
return false;
5858
}
59+
5960
const hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
6061
if (hook.isDisabled) {
6162
// This isn't a real property on the hook, but it can be set to opt out

0 commit comments

Comments
 (0)