From e3765e6a892885396c5ec5e347ca621e1eaab54c Mon Sep 17 00:00:00 2001 From: Paul Kaplan <pkaplan@media.mit.edu> Date: Fri, 7 Dec 2018 09:52:13 -0500 Subject: [PATCH] Fix issues with leavePageConfirm --- src/lib/project-saver-hoc.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/project-saver-hoc.jsx b/src/lib/project-saver-hoc.jsx index af66847a4..c92acdd4d 100644 --- a/src/lib/project-saver-hoc.jsx +++ b/src/lib/project-saver-hoc.jsx @@ -52,7 +52,7 @@ const ProjectSaverHOC = function (WrappedComponent) { if (typeof window === 'object') { // Note: it might be better to use a listener instead of assigning onbeforeunload; // but then it'd be hard to turn this listening off in our tests - window.onbeforeunload = () => this.leavePageConfirm; + window.onbeforeunload = (e) => this.leavePageConfirm(e); } } componentDidUpdate (prevProps) { @@ -102,7 +102,7 @@ const ProjectSaverHOC = function (WrappedComponent) { (e || window.event).returnValue = true; return true; } - return false; // do not prompt + return; // Returning undefined prevents the prompt from coming up } clearAutoSaveTimeout () { if (this.props.autoSaveTimeoutId !== null) { -- GitLab