Skip to content

Commit 4e8df58

Browse files
committed
Fix history block
1 parent 68c062f commit 4e8df58

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/frontend/components/App/index.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,14 @@ class App extends BaseComponent {
7575

7676
toggleHistoryBlock(enable = !this.unblock) {
7777
if (enable) {
78-
const { saved } = this.props.current;
7978
const warningMessage = 'Are you sure you want to discard changes?';
80-
window.onbeforeunload = () => saved ? undefined : warningMessage;
79+
window.onbeforeunload = () => {
80+
const { saved } = this.props.current;
81+
if (!saved) return warningMessage;
82+
};
8183
this.unblock = this.props.history.block((location) => {
8284
if (location.pathname === this.props.location.pathname) return;
85+
const { saved } = this.props.current;
8386
if (!saved) return warningMessage;
8487
});
8588
} else {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy