From fe6ef9653d3dc3fa4cdcaf5b0f0bb4563785da63 Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Mon, 5 Nov 2018 06:31:22 -0500 Subject: [PATCH] simpler file menu closing on project create and save --- src/components/menu-bar/menu-bar.jsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/components/menu-bar/menu-bar.jsx b/src/components/menu-bar/menu-bar.jsx index 5796c7852..b82ed04ae 100644 --- a/src/components/menu-bar/menu-bar.jsx +++ b/src/components/menu-bar/menu-bar.jsx @@ -142,13 +142,6 @@ class MenuBar extends React.Component { 'restoreOptionMessage' ]); } - componentDidUpdate (prevProps) { - // if we're no longer showing the project (loading, or whatever), close menus - if (this.props.isShowingProject && !prevProps.isShowingProject) { - this.props.onRequestCloseFile(); - this.props.onRequestCloseEdit(); - } - } handleClickNew () { // if canSave===true and canCreateNew===true, it's safe to replace current project, // since we will auto-save first. Else, confirm first. @@ -158,15 +151,19 @@ class MenuBar extends React.Component { if (readyToReplaceProject) { this.props.onClickNew(this.props.canSave && this.props.canCreateNew); } + this.props.onRequestCloseFile(); } handleClickRemix () { this.props.onClickRemix(); + this.props.onRequestCloseFile(); } handleClickSave () { this.props.onClickSave(); + this.props.onRequestCloseFile(); } handleClickSaveAsCopy () { this.props.onClickSaveAsCopy(); + this.props.onRequestCloseFile(); } handleRestoreOption (restoreFun) { return () => {