From e82180e0442bb16e6acc7442bf5152498069ce4c Mon Sep 17 00:00:00 2001 From: Ben Wheeler <wheeler.benjamin@gmail.com> Date: Mon, 8 Oct 2018 16:48:57 -0400 Subject: [PATCH] using project-id state for menu-bar's saving indicator --- src/components/menu-bar/menu-bar.jsx | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/components/menu-bar/menu-bar.jsx b/src/components/menu-bar/menu-bar.jsx index e40db73ab..573b4b354 100644 --- a/src/components/menu-bar/menu-bar.jsx +++ b/src/components/menu-bar/menu-bar.jsx @@ -138,22 +138,13 @@ class MenuBar extends React.Component { 'handleRestoreOption', 'restoreOptionMessage' ]); - this.state = {projectSaveInProgress: false}; } - componentWillReceiveProps (newProps) { + componentDidUpdate (prevProps) { // if we're no longer showing the project (loading, or whatever), close menus - if (newProps.isShowingProject && !this.props.isShowingProject) { + if (this.props.isShowingProject && !prevProps.isShowingProject) { this.props.onRequestCloseFile(); this.props.onRequestCloseEdit(); } - // if we're now saving, show save in progress - if (newProps.isSavingWithId && !this.props.isSavingWithId) { - this.setState({projectSaveInProgress: true}); - } - // if we're no longer saving, don't show save in progress - if (!newProps.isSavingWithId && this.props.isSavingWithId) { - this.setState({projectSaveInProgress: false}); - } } handleClickNew () { if (this.props.sessionExists && this.props.username) { // logged in @@ -240,7 +231,7 @@ class MenuBar extends React.Component { className={classNames( this.props.className, styles.menuBar, - {[styles.saveInProgress]: this.state.projectSaveInProgress} + {[styles.saveInProgress]: this.props.isSavingWithId} )} > <div className={styles.mainMenu}> -- GitLab