Merge branch 'sentry-errors' into 'main'

Fix Sentry errors

See merge request soapbox-pub/soapbox!2822
environments/review-main-yi2y9f/deployments/4189
Alex Gleason 11 months ago
commit 5da16c32ea

@ -26,6 +26,10 @@ async function startSentry(dsn: string): Promise<void> {
// localForage error in FireFox private browsing mode (which doesn't support IndexedDB). // 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. // We only use IndexedDB as a cache, so we can safely ignore the error.
'No available storage method found', '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: [ denyUrls: [
// Browser extensions. // Browser extensions.
@ -34,8 +38,6 @@ async function startSentry(dsn: string): Promise<void> {
/^moz-extension:\/\//i, /^moz-extension:\/\//i,
], ],
// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0, tracesSampleRate: 1.0,
}); });

@ -19,7 +19,7 @@ const createAudio = (sources: Sound[]): HTMLAudioElement => {
}; };
/** Play HTML5 sound. */ /** Play HTML5 sound. */
const play = (audio: HTMLAudioElement): void => { const play = (audio: HTMLAudioElement): Promise<void> => {
if (!audio.paused) { if (!audio.paused) {
audio.pause(); audio.pause();
if (typeof audio.fastSeek === 'function') { 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<Sounds, HTMLAudioElement> = { const soundCache: Record<Sounds, HTMLAudioElement> = {

Loading…
Cancel
Save