Merge pull request #4158 from paulkaplan/fix-unload-alert

Do not remove the window beforeunload handler in componentWillUnmount.
This commit is contained in:
Paul Kaplan authored and GitHub committed 2018-12-20 08:29:17 -05:00
commit 8f554a74e0
1 file changed
+4 -1
+4 -1
View File
@@ -100,7 +100,10 @@ const ProjectSaverHOC = function (WrappedComponent) {
}
componentWillUnmount () {
this.clearAutoSaveTimeout();
window.onbeforeunload = undefined; // eslint-disable-line no-undefined
// Cant unset the beforeunload because it might no longer belong to this component
// i.e. if another of this component has been mounted before this one gets unmounted
// which happens when going from project to editor view.
// window.onbeforeunload = undefined; // eslint-disable-line no-undefined
}
leavePageConfirm (e) {
if (this.props.projectChanged) {