From 953f0c700006041f9c2e58ce246355a394fb17a3 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Wed, 24 Jul 2019 17:30:40 +0200 Subject: [PATCH 1/3] defining class attribute instead of using component name --- scm-ui-components/packages/ui-components/src/layout/Page.js | 4 ++-- .../packages/ui-components/src/layout/PageActions.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scm-ui-components/packages/ui-components/src/layout/Page.js b/scm-ui-components/packages/ui-components/src/layout/Page.js index 403bae91e6..c7a7f66cf4 100644 --- a/scm-ui-components/packages/ui-components/src/layout/Page.js +++ b/scm-ui-components/packages/ui-components/src/layout/Page.js @@ -51,7 +51,7 @@ class Page extends React.Component { let pageActionsExists = false; React.Children.forEach(children, child => { if (child && !error) { - if (child.type.name === PageActions.name) { + if (child.displayName === PageActions.displayName) { pageActions = (
{ let content = []; React.Children.forEach(children, child => { if (child) { - if (child.type.name !== PageActions.name) { + if (child.displayName !== PageActions.displayName) { content.push(child); } } diff --git a/scm-ui-components/packages/ui-components/src/layout/PageActions.js b/scm-ui-components/packages/ui-components/src/layout/PageActions.js index eb055a5605..d713e8ce11 100644 --- a/scm-ui-components/packages/ui-components/src/layout/PageActions.js +++ b/scm-ui-components/packages/ui-components/src/layout/PageActions.js @@ -8,7 +8,9 @@ type Props = { children: React.Node }; -class PageActions extends React.Component { +export default class PageActions extends React.Component { + displayName: string = "PageActions"; + render() { return <>{this.renderContent()}; } @@ -24,5 +26,3 @@ class PageActions extends React.Component { return children; } } - -export default PageActions; From e511f723e57dde0fc4bf1069763d2cd7c38ff2dc Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 28 Aug 2019 08:07:46 +0200 Subject: [PATCH 2/3] fix PageAction detection by using a static class property --- .../packages/ui-components/src/layout/Page.js | 9 +++++++-- .../packages/ui-components/src/layout/PageActions.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scm-ui-components/packages/ui-components/src/layout/Page.js b/scm-ui-components/packages/ui-components/src/layout/Page.js index c7a7f66cf4..622c4b429c 100644 --- a/scm-ui-components/packages/ui-components/src/layout/Page.js +++ b/scm-ui-components/packages/ui-components/src/layout/Page.js @@ -44,6 +44,11 @@ class Page extends React.Component { ); } + isPageAction(node: any) { + return node.displayName === PageActions.displayName + || (node.type && node.type.displayName === PageActions.displayName); + } + renderPageHeader() { const { error, title, subtitle, children, classes } = this.props; @@ -51,7 +56,7 @@ class Page extends React.Component { let pageActionsExists = false; React.Children.forEach(children, child => { if (child && !error) { - if (child.displayName === PageActions.displayName) { + if (this.isPageAction(child)) { pageActions = (
{ let content = []; React.Children.forEach(children, child => { if (child) { - if (child.displayName !== PageActions.displayName) { + if (!this.isPageAction(child)) { content.push(child); } } diff --git a/scm-ui-components/packages/ui-components/src/layout/PageActions.js b/scm-ui-components/packages/ui-components/src/layout/PageActions.js index d713e8ce11..98f0a21634 100644 --- a/scm-ui-components/packages/ui-components/src/layout/PageActions.js +++ b/scm-ui-components/packages/ui-components/src/layout/PageActions.js @@ -9,7 +9,7 @@ type Props = { }; export default class PageActions extends React.Component { - displayName: string = "PageActions"; + static displayName = "PageActions"; render() { return <>{this.renderContent()}; From 590b06784fda3a610384073b8c2b7ebc427a35b3 Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Mon, 2 Sep 2019 12:15:48 +0000 Subject: [PATCH 3/3] Close branch bugfix/pageactions_check