diff --git a/client/coral-admin/src/routes/Configure/containers/Configure.js b/client/coral-admin/src/routes/Configure/containers/Configure.js index 6df911104..4affc53f5 100644 --- a/client/coral-admin/src/routes/Configure/containers/Configure.js +++ b/client/coral-admin/src/routes/Configure/containers/Configure.js @@ -3,7 +3,6 @@ import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { compose, gql } from 'react-apollo'; import { withQuery, withMergedSettings } from 'coral-framework/hocs'; -import ClickOutside from 'coral-framework/components/ClickOutside'; import { Spinner } from 'coral-ui'; import PropTypes from 'prop-types'; import { withUpdateSettings } from 'coral-framework/graphql/mutations'; @@ -49,12 +48,17 @@ class ConfigureContainer extends React.Component { return !!Object.keys(this.props.pending).length; }; - onClickOutside = () => { + routeLeave = () => { if (this.shouldShowSaveDialog()) { this.props.showSaveDialog(); + return false; } }; + componentDidMount() { + this.props.router.setRouteLeaveHook(this.props.route, this.routeLeave); + } + render() { if (this.props.data.error) { return
{this.props.data.error.message}
; @@ -65,23 +69,21 @@ class ConfigureContainer extends React.Component { } return ( - - - {this.props.children} - - + + {this.props.children} + ); } } @@ -156,4 +158,5 @@ ConfigureContainer.propTypes = { mergedSettings: PropTypes.object.isRequired, children: PropTypes.node.isRequired, router: PropTypes.object, + route: PropTypes.object, };