diff --git a/bundle.js b/bundle.js index ffa6f98d5..efec538d5 100644 --- a/bundle.js +++ b/bundle.js @@ -78188,6 +78188,19 @@ const alert = (message, type = 'primary', timeout = 5e3) => { }, timeout); } +window.addEventListener("error", (event) => { + // Handle KO binding errors, usually occur when knockout is trying to use functions that + // don't exist in the cached javascript, but could also be a genuine error that slipped through + if (event?.error?.message?.startsWith("Unable to process binding")) { + alert( + `There was an error loading the page. Hard Refresh (Ctrl+F5 or Cmd+Shift+R) to clear the cache. + If this persists please post in #wiki-general on discord.`, + 'danger', + 3600e3 + ); + } +}); + module.exports = { alert, }; diff --git a/scripts/notifications.js b/scripts/notifications.js index 9ae69b417..b92bcf8c3 100644 --- a/scripts/notifications.js +++ b/scripts/notifications.js @@ -16,6 +16,19 @@ const alert = (message, type = 'primary', timeout = 5e3) => { }, timeout); } +window.addEventListener("error", (event) => { + // Handle KO binding errors, usually occur when knockout is trying to use functions that + // don't exist in the cached javascript, but could also be a genuine error that slipped through + if (event?.error?.message?.startsWith("Unable to process binding")) { + alert( + `There was an error loading the page. Hard Refresh (Ctrl+F5 or Cmd+Shift+R) to clear the cache. + If this persists please post in #wiki-general on discord.`, + 'danger', + 3600e3 + ); + } +}); + module.exports = { alert, };