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 rickhanlonii committed Oct 5, 2022
1 parent eb083b7 commit 72f5995
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 72f5995

Please sign in to comment.