Skip to content

Commit

Permalink
[DevTools][Bugfix] Don't hide fragment if it has a key (#25197)
Browse files Browse the repository at this point in the history
resolves #25187

---

We shouldn't hide fragments that have a key because this is important information that the user might want in the future.
  • Loading branch information
lunaruan authored and sammy-SC committed Sep 11, 2022
1 parent 7a38164 commit a78c298
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/react-devtools-shared/src/backend/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,9 @@ export function getInternalReactConstants(
return type;
case HostPortal:
case HostText:
case Fragment:
return null;
case Fragment:
return 'Fragment';
case LazyComponent:
// This display name will not be user visible.
// Once a Lazy component loads its inner component, React replaces the tag and type.
Expand Down Expand Up @@ -981,7 +982,7 @@ export function attach(

// NOTICE Keep in sync with get*ForFiber methods
function shouldFilterFiber(fiber: Fiber): boolean {
const {_debugSource, tag, type} = fiber;
const {_debugSource, tag, type, key} = fiber;

switch (tag) {
case DehydratedSuspenseComponent:
Expand All @@ -993,13 +994,14 @@ export function attach(
return true;
case HostPortal:
case HostText:
case Fragment:
case LegacyHiddenComponent:
case OffscreenComponent:
return true;
case HostRoot:
// It is never valid to filter the root element.
return false;
case Fragment:
return key === null;
default:
const typeSymbol = getTypeSymbol(type);

Expand Down

0 comments on commit a78c298

Please sign in to comment.