diff --git a/client/src/lib/page.js b/client/src/lib/page.js index 27528487..d929f251 100644 --- a/client/src/lib/page.js +++ b/client/src/lib/page.js @@ -381,14 +381,6 @@ class SectionContentBase extends Component { flashMessageText: '' }; - /*this.historyUnlisten = props.history.listen((location, action) => { - if (action === "REPLACE") return; - if (location.state && location.state.preserveFlashMessage) return; - - // noinspection JSIgnoredPromiseFromCall - this.closeFlashMessage(); - });*/ - this.beforeUnloadListeners = new BeforeUnloadListeners(); this.beforeUnloadHandler = ::this.onBeforeUnload; this.historyUnblock = null; @@ -428,6 +420,14 @@ class SectionContentBase extends Component { this.historyUnblock();*/ } + componentDidUpdate(prevProps) { + if (prevProps.location === this.props.location) return; + if (this.props.location.state && this.props.location.state.preserveFlashMessage) return; + + // noinspection JSIgnoredPromiseFromCall + this.closeFlashMessage(); + } + setFlashMessage(severity, text) { this.setState({ flashMessageText: text,