From 6af13dbac2179c8fd2c63bcf175c04a112f8c080 Mon Sep 17 00:00:00 2001
From: silverwind <me@silverwind.io>
Date: Fri, 22 May 2020 12:57:54 +0200
Subject: [PATCH] Close EventSource before unloading the page (#11539)

Should eliminate a error in the Firefox console regarding the connection
being interrupted while the page was loading.
---
 web_src/js/features/notification.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/web_src/js/features/notification.js b/web_src/js/features/notification.js
index 8b843e9806..0ea7f93c8d 100644
--- a/web_src/js/features/notification.js
+++ b/web_src/js/features/notification.js
@@ -52,6 +52,9 @@ export function initNotificationCount() {
       source.close();
       window.location.href = AppSubUrl;
     });
+    window.addEventListener('beforeunload', () => {
+      source.close();
+    });
     return;
   }