From c4d7c6b84c16b3fc87540d1ffdbd4197596f53e1 Mon Sep 17 00:00:00 2001 From: Emily Marigold Klassen Date: Tue, 30 Mar 2021 18:54:45 -0700 Subject: [PATCH] fix: add displayNames to generated components --- packages/component/src/createLoadable.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/component/src/createLoadable.js b/packages/component/src/createLoadable.js index fdaa0773..4918fd2c 100644 --- a/packages/component/src/createLoadable.js +++ b/packages/component/src/createLoadable.js @@ -26,11 +26,18 @@ function resolveConstructor(ctor) { return ctor } -const withChunkExtractor = Component => props => ( - - {extractor => } - -) +const withChunkExtractor = Component => { + const LoadableWithChunkExtractor = props => ( + + {extractor => } + + ) + if (Component.displayName) { + LoadableWithChunkExtractor.displayName = + `${Component.displayName}WithChunkExtractor`; + } + return LoadableWithChunkExtractor +} const identity = v => v @@ -332,6 +339,8 @@ function createLoadable({ )) + Loadable.displayName = 'Loadable' + // In future, preload could use `` Loadable.preload = props => { ctor.requireAsync(props)