Add displayName for each plugin HOC (#1735)

This commit is contained in:
CHaBou 2017-04-12 20:22:51 +02:00 committed by Matheus Fernandes
parent c63df8f149
commit f3594b3b14

View file

@ -391,6 +391,7 @@ function exposeDecorated(Component) {
function getDecorated(parent, name) {
if (!decorated[name]) {
let class_ = exposeDecorated(parent);
class_.displayName = `_exposeDecorated(${name})`;
modules.forEach(mod => {
const method = 'decorate' + name;
@ -401,6 +402,7 @@ function getDecorated(parent, name) {
try {
class__ = fn(class_, {React, Component, Notification, notify});
class__.displayName = `${fn._pluginName}(${name})`;
} catch (err) {
console.error(err.stack);
notify('Plugin error', `${fn._pluginName}: Error occurred in \`${method}\`. Check Developer Tools for details`);