diff --git a/src/components/TopBar/ProjectToolBar.js b/src/components/TopBar/ProjectToolBar.js index e0e07b3ec..6a1474ed8 100644 --- a/src/components/TopBar/ProjectToolBar.js +++ b/src/components/TopBar/ProjectToolBar.js @@ -72,7 +72,7 @@ class ProjectToolBar extends React.Component { {_.unescape(project.name)} {isTooltipVisible &&
{_.unescape(project.name)}
} } -
{_.unescape(project.name)}
+ {project && project.name &&
{_.unescape(project.name)}
}
{userMenu} diff --git a/src/projects/detail/ProjectDetail.jsx b/src/projects/detail/ProjectDetail.jsx index 366b5198d..fd5b05e96 100644 --- a/src/projects/detail/ProjectDetail.jsx +++ b/src/projects/detail/ProjectDetail.jsx @@ -57,20 +57,20 @@ const ProjectDetailView = (props) => { const regex = /#(feed-([0-9]+)|comment-([0-9]+))/ const match = props.location.hash.match(regex) const ids = match ? { feedId: match[2], commentId: match[3] } : {} - const children = React.Children.map(props.children, (child) => { - return React.cloneElement(child, { - project: props.project, - currentMemberRole: currentMemberRole || '', - isSuperUser: props.isSuperUser, - isManageUser: props.isManageUser, - isCustomerUser: props.isCustomerUser, - isProcessing: props.isProcessing, - allProductTemplates: props.allProductTemplates, - productsTimelines: props.productsTimelines, - ...ids - }) - }) - return
{children}
+ + const { component: Component } = props + const componentProps = { + project: props.project, + currentMemberRole: currentMemberRole || '', + isSuperUser: props.isSuperUser, + isManageUser: props.isManageUser, + isCustomerUser: props.isCustomerUser, + isProcessing: props.isProcessing, + allProductTemplates: props.allProductTemplates, + productsTimelines: props.productsTimelines, + ...ids + } + return } const EnhancedProjectDetailView = spinner(errorHandler(ProjectDetailView)) diff --git a/src/projects/routes.jsx b/src/projects/routes.jsx index 2632facea..14fe6d4d9 100644 --- a/src/projects/routes.jsx +++ b/src/projects/routes.jsx @@ -21,20 +21,15 @@ import { requiresAuthentication } from '../components/AuthenticatedComponent' const ProjectLayoutWithAuth = requiresAuthentication(ProjectLayout) const FileDownloadWithAuth = requiresAuthentication(FileDownload) -// NOTE: -// we cannot move up ProjectDetail component -// we have to keep it like it's done below because -// Dashboard, SpecificationContainer and ProjectMessages have to be immediate children -// of ProjectDetail component because ProjectDetail updates children props by React.Children method const ProjectDetailWithAuth = withProps({ main: - } /> - } /> - } /> - } /> - } /> - } /> - } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> } /> })(ProjectLayoutWithAuth)