Skip to content

Commit

Permalink
fix[devtools/updateFiberRecursively]: mount suspense fallback set in …
Browse files Browse the repository at this point in the history
…timed-out case
  • Loading branch information
hoxyq committed Jul 25, 2023
1 parent 587ae49 commit 3d94214
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions packages/react-devtools-shared/src/backend/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools-shared/src/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion packages/react-reconciler/src/ReactFiberDevToolsHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3d94214

Please sign in to comment.