We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 47f7f2f commit 71aea53Copy full SHA for 71aea53
src/frontend/components/App/index.jsx
@@ -75,11 +75,14 @@ class App extends BaseComponent {
75
76
toggleHistoryBlock(enable = !this.unblock) {
77
if (enable) {
78
+ const warningMessage = 'Are you sure you want to discard changes?';
79
+ window.onbeforeunload = () => this.isSaved() ? undefined : warningMessage;
80
this.unblock = this.props.history.block((location) => {
81
if (location.pathname === this.props.location.pathname) return;
- if (!this.isSaved()) return 'Are you sure want to discard changes?';
82
+ if (!this.isSaved()) return warningMessage;
83
});
84
} else {
85
+ window.onbeforeunload = undefined;
86
this.unblock();
87
this.unblock = undefined;
88
}
0 commit comments