From 7bc077a420298aecfe4a6f18c2d06ed2045b9371 Mon Sep 17 00:00:00 2001 From: Index Date: Fri, 28 Jun 2024 12:42:16 -0500 Subject: [PATCH] fix: fix context invalidation when using reload keybind --- js/sitewide.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/js/sitewide.js b/js/sitewide.js index c5292b6..3543ece 100755 --- a/js/sitewide.js +++ b/js/sitewide.js @@ -60,9 +60,16 @@ let Theme = ``; document.addEventListener("keypress", function (e) { currentCombination += e.key; if (currentCombination === combination && document.activeElement.tagName !== "INPUT" && document.activeElement.tagName !== "TEXTAREA") { - console.log("Reloading Poly+..."); - chrome.runtime.sendMessage({ action: "reload" }); - window.location.reload(); + try { + console.log("Reloading Poly+..."); + chrome.runtime.sendMessage({ action: "reload" }); + window.location.reload(); + } catch(error) { + console.log("Reloading Poly+..."); + window.location.reload() + chrome.runtime.sendMessage({ action: "reload" }); + window.location.reload(); + } } else if (!combination.startsWith(currentCombination)) { currentCombination = ""; }