From 98138181f7d117a81934307f9808981e65205168 Mon Sep 17 00:00:00 2001 From: connorhaugh <49422820+connorhaugh@users.noreply.github.com> Date: Wed, 24 Apr 2024 11:04:12 -0400 Subject: [PATCH] feat: add browser dialog to prevent navigation (#962) Switching from undefined to "" tells the browser to put in a modal which requires users to confirm thier navigation away. this will prevent continued annoyances from upload failures: https://2u-internal.atlassian.net/browse/TNL-11587 --- src/files-and-videos/videos-page/VideosPage.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/files-and-videos/videos-page/VideosPage.jsx b/src/files-and-videos/videos-page/VideosPage.jsx index 354db5409..18e79d40b 100644 --- a/src/files-and-videos/videos-page/VideosPage.jsx +++ b/src/files-and-videos/videos-page/VideosPage.jsx @@ -85,9 +85,12 @@ const VideosPage = ({ useEffect(() => { window.onbeforeunload = () => { dispatch(markVideoUploadsInProgressAsFailed({ uploadingIdsRef, courseId })); + if (addVideoStatus === RequestStatus.IN_PROGRESS) { + return ''; + } return undefined; }; - }, []); + }, [addVideoStatus]); const { isVideoTranscriptEnabled,