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 68c062f commit 4e8df58Copy full SHA for 4e8df58
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 { saved } = this.props.current;
79
const warningMessage = 'Are you sure you want to discard changes?';
80
- window.onbeforeunload = () => saved ? undefined : warningMessage;
+ window.onbeforeunload = () => {
+ const { saved } = this.props.current;
81
+ if (!saved) return warningMessage;
82
+ };
83
this.unblock = this.props.history.block((location) => {
84
if (location.pathname === this.props.location.pathname) return;
85
86
if (!saved) return warningMessage;
87
});
88
} else {
0 commit comments