Skip to content

Commit

Permalink
fix: fix intempestive alerts in the debug UI when using the polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Aug 12, 2022
1 parent 1bcd315 commit 578f7d8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion public/app.js
Expand Up @@ -18,13 +18,20 @@
const error = (e) => {
console.log(e);

if (e.error?.message?.includes?.('Reconnecting')) {
// Silent reconnecting messages from the polyfill
return;
}

if (e.toString !== Object.prototype.toString) {
// Display relevant error message
alert(e.toString());

return;
}

if (e.statusText) {
// Special handling of errors from the polyfill
alert(e.statusText);

return;
Expand Down Expand Up @@ -157,7 +164,7 @@ foo`;
$subscribeForm.elements.unsubscribe.onclick = function (e) {
e.preventDefault();

updateEventSource.close();
updateEventSource && updateEventSource.close();
this.disabled = true;
$updates.textContent = "Unsubscribed.";
};
Expand Down

0 comments on commit 578f7d8

Please sign in to comment.