Skip to content

[DevTools] Dedicated empty state for roots that aren't suspended by anything#507

Closed
everettbu wants to merge 1 commit into
mainfrom
sebbie/02-12-_devtools_dedicated_empty_state_for_roots_that_aren_t_suspended_by_anything
Closed

[DevTools] Dedicated empty state for roots that aren't suspended by anything#507
everettbu wants to merge 1 commit into
mainfrom
sebbie/02-12-_devtools_dedicated_empty_state_for_roots_that_aren_t_suspended_by_anything

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of facebook/react#35769
Original author: eps1lon


Summary

Stacked on react/react#35768

For roots without any suspenders, the inspected element pane is completely empty. For older versions of React without Suspense, older versions of React with less sources for Suspense, or simple UIs that don't have any suspenders this can look like something isn't working. You're mostly inspecting the root in the Suspense tab so we need something to show.

How did you test this change?

@everettbu everettbu added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 12, 2026
@greptile-apps

greptile-apps Bot commented Feb 12, 2026

Copy link
Copy Markdown

Greptile Overview

Greptile Summary

added dedicated empty state message "Nothing suspended the initial paint" for root elements that have no suspenders in the DevTools Suspense tab

Key changes:

  • imported ElementTypeRoot type to check if inspected element is a root
  • added conditional return (lines 485-495) to display empty state UI for root elements when suspendedBy is empty/null and element is not actively suspended

Purpose:
prevents confusing blank pane for roots without suspenders (common in older React versions, simpler UIs, or versions with fewer Suspense sources)

Note from previous review thread:
the issue mentioned about potential null access at line 510 when suspendedBy is null/empty for non-root, non-suspended elements remains unaddressed by this change - this PR only adds the root element case

Confidence Score: 2/5

  • unsafe to merge - introduces null pointer exception for non-root elements
  • the PR improves UX by showing empty state for root elements, but removes the return null fallback that was handling non-root elements with no suspenders, creating a crash when suspendedBy.length is accessed on null at line 510
  • packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js needs a return null added after the root element check

Important Files Changed

Filename Overview
packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js adds dedicated empty state for root elements with no suspenders - improves UX but doesn't fully address null safety issue

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +481 to 496
// For roots, show an empty state since there's nothing else to show for
// these elements.
// This can happen for older versions of React without Suspense, older versions
// of React with less sources for Suspense, or simple UIs that don't have any suspenders.
if (inspectedElement.type === ElementTypeRoot) {
return (
<div>
<div className={styles.HeaderRow}>
<div className={`${styles.Header} ${styles.Empty}`}>
Nothing suspended the initial paint.
</div>
</div>
</div>
);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when suspendedBy is null/empty, not suspended, and not a root element, the function continues without returning, then tries to access suspendedBy.length at line 510

Suggested change
// For roots, show an empty state since there's nothing else to show for
// these elements.
// This can happen for older versions of React without Suspense, older versions
// of React with less sources for Suspense, or simple UIs that don't have any suspenders.
if (inspectedElement.type === ElementTypeRoot) {
return (
<div>
<div className={styles.HeaderRow}>
<div className={`${styles.Header} ${styles.Empty}`}>
Nothing suspended the initial paint.
</div>
</div>
</div>
);
}
}
// For roots, show an empty state since there's nothing else to show for
// these elements.
// This can happen for older versions of React without Suspense, older versions
// of React with less sources for Suspense, or simple UIs that don't have any suspenders.
if (inspectedElement.type === ElementTypeRoot) {
return (
<div>
<div className={styles.HeaderRow}>
<div className={`${styles.Header} ${styles.Empty}`}>
Nothing suspended the initial paint.
</div>
</div>
</div>
);
}
return null;
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js
Line: 481:496

Comment:
when `suspendedBy` is null/empty, not suspended, and not a root element, the function continues without returning, then tries to access `suspendedBy.length` at line 510

```suggestion
    // For roots, show an empty state since there's nothing else to show for
    // these elements.
    // This can happen for older versions of React without Suspense, older versions
    // of React with less sources for Suspense, or simple UIs that don't have any suspenders.
    if (inspectedElement.type === ElementTypeRoot) {
      return (
        <div>
          <div className={styles.HeaderRow}>
            <div className={`${styles.Header} ${styles.Empty}`}>
              Nothing suspended the initial paint.
            </div>
          </div>
        </div>
      );
    }
    return null;
```

How can I resolve this? If you propose a fix, please make it concise.

@everettbu
everettbu force-pushed the sebbie/02-12-_devtools_dedicated_empty_state_for_roots_that_aren_t_suspended_by_anything branch from 7ebf943 to c30e925 Compare February 12, 2026 16:31

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

</div>
);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing return null for non-root elements - when suspendedBy is null/empty and element is not suspended and not a root, the code continues to line 510 where suspendedBy.length will throw TypeError

before this PR, line 480 had return null that handled this case

Suggested change
}
}
return null;
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js
Line: 496:496

Comment:
missing `return null` for non-root elements - when `suspendedBy` is null/empty and element is not suspended and not a root, the code continues to line 510 where `suspendedBy.length` will throw `TypeError`

before this PR, line 480 had `return null` that handled this case

```suggestion
    }
    return null;
  }
```

How can I resolve this? If you propose a fix, please make it concise.

@everettbu

Copy link
Copy Markdown
Author

Upstream PR was closed or merged. Code is synced via branch mirror.

@everettbu everettbu closed this Feb 12, 2026
@everettbu
everettbu deleted the sebbie/02-12-_devtools_dedicated_empty_state_for_roots_that_aren_t_suspended_by_anything branch February 12, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants