Skip to content

Commit 695d7f2

Browse files
committed
Revert 18e9e49, only ask to close window if user has changed something
(closes facebook#1507)
1 parent 1753174 commit 695d7f2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

modules/core/EditSystem.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,11 @@ export class EditSystem extends AbstractSystem {
135135

136136
// Setup event handlers
137137
window.addEventListener('beforeunload', e => {
138-
e.preventDefault();
139-
this.saveBackup();
140-
return (e.returnValue = ''); // show browser prompt
138+
if (this._history.length > 1) { // user did something
139+
e.preventDefault();
140+
this.saveBackup();
141+
return (e.returnValue = ''); // show browser prompt
142+
}
141143
});
142144

143145
window.addEventListener('unload', () => this._mutex.unlock());

0 commit comments

Comments
 (0)