Skip to content

Commit

Permalink
fix: reset side menu selection when space is updated
Browse files Browse the repository at this point in the history
closes #187
  • Loading branch information
juancarlosfarah committed Sep 7, 2019
1 parent 7391bf5 commit ceb5983
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/space/SpaceScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,18 @@ class SpaceScreen extends Component {
}

componentDidUpdate() {
const { selected } = this.state;
const {
deleted,
phase,
history: { replace },
} = this.props;
// redirect to home if space is deleted
if (deleted) {
replace(HOME_PATH);
} else if (selected !== -1 && (!phase || phase.isEmpty())) {
// eslint-disable-next-line react/no-did-update-set-state
this.setState({ selected: -1 });
}
}

Expand Down

0 comments on commit ceb5983

Please sign in to comment.