From 9e259da40a5c0359b545b5fd2fff9c5e83cb4c93 Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 6 Sep 2022 17:02:48 -0700 Subject: [PATCH] don't hide fragment if it has a key --- packages/react-devtools-shared/src/backend/renderer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/react-devtools-shared/src/backend/renderer.js b/packages/react-devtools-shared/src/backend/renderer.js index df1c5d53e0776..3a893060da0ad 100644 --- a/packages/react-devtools-shared/src/backend/renderer.js +++ b/packages/react-devtools-shared/src/backend/renderer.js @@ -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. @@ -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: @@ -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);