Skip to content

Commit

Permalink
Fix hiding flash message on page change
Browse files Browse the repository at this point in the history
  • Loading branch information
Mnaukal committed Jun 12, 2024
1 parent d3b8f18 commit 61f35bc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions client/src/lib/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 61f35bc

Please sign in to comment.