Skip to content

Commit 72f5995

Browse files
lunaruanrickhanlonii
authored andcommitted
[DevTools][Bugfix] Don't hide fragment if it has a key (#25197)
resolves #25187 --- We shouldn't hide fragments that have a key because this is important information that the user might want in the future.
1 parent eb083b7 commit 72f5995

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,9 @@ export function getInternalReactConstants(
468468
return type;
469469
case HostPortal:
470470
case HostText:
471-
case Fragment:
472471
return null;
472+
case Fragment:
473+
return 'Fragment';
473474
case LazyComponent:
474475
// This display name will not be user visible.
475476
// Once a Lazy component loads its inner component, React replaces the tag and type.
@@ -981,7 +982,7 @@ export function attach(
981982

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

986987
switch (tag) {
987988
case DehydratedSuspenseComponent:
@@ -993,13 +994,14 @@ export function attach(
993994
return true;
994995
case HostPortal:
995996
case HostText:
996-
case Fragment:
997997
case LegacyHiddenComponent:
998998
case OffscreenComponent:
999999
return true;
10001000
case HostRoot:
10011001
// It is never valid to filter the root element.
10021002
return false;
1003+
case Fragment:
1004+
return key === null;
10031005
default:
10041006
const typeSymbol = getTypeSymbol(type);
10051007

0 commit comments

Comments
 (0)