Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alert when the page fails to load due to Knockout binding failure #165

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -78327,6 +78327,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,
};
Expand Down
13 changes: 13 additions & 0 deletions scripts/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};