From 1604e5061b1f2ff06cd124e2463079c4ffca2df2 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 15 Oct 2023 17:12:48 -0500 Subject: [PATCH 1/2] Sentry: ignore ResizeObserver errors from Virtuoso --- src/sentry.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sentry.ts b/src/sentry.ts index 8d84b122a..22198dc25 100644 --- a/src/sentry.ts +++ b/src/sentry.ts @@ -26,6 +26,10 @@ async function startSentry(dsn: string): Promise { // localForage error in FireFox private browsing mode (which doesn't support IndexedDB). // We only use IndexedDB as a cache, so we can safely ignore the error. 'No available storage method found', + // Virtuoso throws these errors, but it is a false-positive. + // https://github.com/petyosi/react-virtuoso/issues/254 + 'ResizeObserver loop completed with undelivered notifications.', + 'ResizeObserver loop limit exceeded', ], denyUrls: [ // Browser extensions. @@ -34,8 +38,6 @@ async function startSentry(dsn: string): Promise { /^moz-extension:\/\//i, ], - // We recommend adjusting this value in production, or using tracesSampler - // for finer control tracesSampleRate: 1.0, }); From 1bfe5908a93f3a41378cec4c5284b31af1425e1f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 15 Oct 2023 17:19:02 -0500 Subject: [PATCH 2/2] sounds: suppress error when user has disabled autoplay --- src/utils/sounds.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/utils/sounds.ts b/src/utils/sounds.ts index 331aed064..fddba87c7 100644 --- a/src/utils/sounds.ts +++ b/src/utils/sounds.ts @@ -19,7 +19,7 @@ const createAudio = (sources: Sound[]): HTMLAudioElement => { }; /** Play HTML5 sound. */ -const play = (audio: HTMLAudioElement): void => { +const play = (audio: HTMLAudioElement): Promise => { if (!audio.paused) { audio.pause(); if (typeof audio.fastSeek === 'function') { @@ -29,7 +29,15 @@ const play = (audio: HTMLAudioElement): void => { } } - audio.play(); + return audio.play().catch((error: Error) => { + if (error.name === 'NotAllowedError') { + // User has disabled autoplay. + // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide + return; + } else { + throw error; + } + }); }; const soundCache: Record = {