Skip to content

Commit

Permalink
fix errors dialog open/close
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-deboer committed Oct 30, 2017
1 parent 86504df commit fac7a12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
21 changes: 4 additions & 17 deletions pkg/ui/src/components/ErrorsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,13 @@ const errorIcons = {
export default connect(mapStateToProps, mapDispatchToProps) (
class ErrorsDialog extends React.Component {

constructor(props) {
super(props)
this.state = {
open: props.open,
}
}

handleClose = () => {
this.setState({open: false})
}

componentWillReceiveProps = (props) => {
this.setState({
open: props.open,
})
this.props.handleClose && this.props.handleClose()
}

shouldComponentUpdate = (nextProps, nextState) => {
return nextState.open !== this.state.open
|| (this.state.open && nextProps.errors.length !== this.props.errors.length)
return nextProps.errors.length !== this.props.errors.length
|| nextProps.open !== this.props.open
}

render() {
Expand Down Expand Up @@ -133,7 +120,7 @@ class ErrorsDialog extends React.Component {
titleStyle={{backgroundColor: red900, color: grey200}}
actions={actions}
modal={false}
open={this.state.open}
open={this.props.open}
onRequestClose={this.handleClose}
autoScrollBodyContent={true}
>
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class Header extends React.Component {
</ToolbarGroup>
</Toolbar>
}>
<ErrorsDialog open={this.state.open}/>
<ErrorsDialog open={this.state.open} handleClose={this.handleClose}/>

<FiltersDialog open={this.state.filtersOpen && this.props.user}
handleClose={this.handleCloseFilters}/>
Expand Down

0 comments on commit fac7a12

Please sign in to comment.