From 45c32606cdac53ef156969b74223fdfa666f7782 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Fri, 8 Sep 2017 10:37:13 -0400 Subject: [PATCH 1/2] Correct & simplify component name detection (Fixes #44) --- src/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 9d91082a..50957b2e 100644 --- a/src/index.js +++ b/src/index.js @@ -206,9 +206,8 @@ export default function renderToString(vnode, context, opts, inner, isSvgMode) { } function getComponentName(component) { - let proto = component.prototype, - ctor = proto && proto.constructor; - return component.displayName || component.name || (proto && (proto.displayName || proto.name)) || getFallbackComponentName(component); + let ctor = component.prototype && component.prototype.constructor; + return ctor.displayName || ctor.name || getFallbackComponentName(component); } function getFallbackComponentName(component) { From 03675fb30521c77f35e21bc8a610bf1a36100840 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Thu, 14 Sep 2017 16:47:46 -0700 Subject: [PATCH 2/2] fix me being silly --- src/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 50957b2e..5fd35006 100644 --- a/src/index.js +++ b/src/index.js @@ -206,8 +206,7 @@ export default function renderToString(vnode, context, opts, inner, isSvgMode) { } function getComponentName(component) { - let ctor = component.prototype && component.prototype.constructor; - return ctor.displayName || ctor.name || getFallbackComponentName(component); + return component.displayName || component!==Function && component.name || getFallbackComponentName(component); } function getFallbackComponentName(component) {