mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
fix PageAction detection by using a static class property
This commit is contained in:
@@ -44,6 +44,11 @@ class Page extends React.Component<Props> {
|
||||
);
|
||||
}
|
||||
|
||||
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<Props> {
|
||||
let pageActionsExists = false;
|
||||
React.Children.forEach(children, child => {
|
||||
if (child && !error) {
|
||||
if (child.displayName === PageActions.displayName) {
|
||||
if (this.isPageAction(child)) {
|
||||
pageActions = (
|
||||
<div
|
||||
className={classNames(
|
||||
@@ -97,7 +102,7 @@ class Page extends React.Component<Props> {
|
||||
let content = [];
|
||||
React.Children.forEach(children, child => {
|
||||
if (child) {
|
||||
if (child.displayName !== PageActions.displayName) {
|
||||
if (!this.isPageAction(child)) {
|
||||
content.push(child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ type Props = {
|
||||
};
|
||||
|
||||
export default class PageActions extends React.Component<Props> {
|
||||
displayName: string = "PageActions";
|
||||
static displayName = "PageActions";
|
||||
|
||||
render() {
|
||||
return <>{this.renderContent()}</>;
|
||||
|
||||
Reference in New Issue
Block a user