Skip to content

Commit

Permalink
Fix getComponentName() for types with nested $$typeof
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Jul 12, 2018
1 parent 32f6f25 commit a482fb4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/shared/getComponentName.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ 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:
return 'Placeholder';
}
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 !== ''
Expand Down

0 comments on commit a482fb4

Please sign in to comment.