From a482fb41c35448cc1f2cc2e1e7b655a11e8f8957 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 12 Jul 2018 14:05:02 +0100 Subject: [PATCH] Fix getComponentName() for types with nested $$typeof --- packages/shared/getComponentName.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/shared/getComponentName.js b/packages/shared/getComponentName.js index f51f6862b3734..a3a3b10f8c05f 100644 --- a/packages/shared/getComponentName.js +++ b/packages/shared/getComponentName.js @@ -32,16 +32,12 @@ function getComponentName(fiber: Fiber): string | null { switch (type) { case REACT_ASYNC_MODE_TYPE: return 'AsyncMode'; - case REACT_CONTEXT_TYPE: - return 'Context.Consumer'; case REACT_FRAGMENT_TYPE: - return 'ReactFragment'; + return 'Fragment'; case REACT_PORTAL_TYPE: - return 'ReactPortal'; + return 'Portal'; case REACT_PROFILER_TYPE: return `Profiler(${fiber.pendingProps.id})`; - case REACT_PROVIDER_TYPE: - return 'Context.Provider'; case REACT_STRICT_MODE_TYPE: return 'StrictMode'; case REACT_PLACEHOLDER_TYPE: @@ -49,6 +45,10 @@ function getComponentName(fiber: Fiber): string | null { } if (typeof type === 'object' && type !== null) { switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + return 'Context.Consumer'; + case REACT_PROVIDER_TYPE: + return 'Context.Provider'; case REACT_FORWARD_REF_TYPE: const functionName = type.render.displayName || type.render.name || ''; return functionName !== ''