fix(studio): suppress ResizeObserver loop noise from error telemetry#1013
Conversation
jrusso1020
left a comment
There was a problem hiding this comment.
Verdict: COMMENT (would-be APPROVE)
Tiny well-scoped fix using the canonical ResizeObserver loop suppression pattern (event.message.includes(...) + stopImmediatePropagation() + preventDefault() at the top of the global error handler). 6 lines, one file. Holding for James's stamp greenlight.
Sanity checks
- Scope is correct — studio window only, not preview iframe. The PostHog
unhandled_errorevent originates frompackages/studio/src/main.tsx:25(the studio window'serrorlistener); the preview iframe's errors flow throughuseConsoleErrorCapture.ts:37-44intoconsoleErrorsstate for the UI's error console, not into telemetry. So suppressing studio-window ResizeObserver noise is sufficient — there's no secondary pipeline still ingesting it. - Source of the 18k events/month confirmed plausible. Studio uses ResizeObserver at
NLEPreview.tsx:137(preview stage sizing) andAudioWaveform.tsx:141(waveform redraw). Both run on user resize / panel adjustment, which fires often. - Browser coverage: substring
"ResizeObserver loop"matches Chrome's"ResizeObserver loop completed with undelivered notifications."AND Firefox's"ResizeObserver loop limit exceeded". ✓ - Convention consistency: matches the existing benign-error filter pattern at
useConsoleErrorCapture.ts:30(if (text.includes("favicon")) return;). - CI: 23 success / 2 in_progress / 0 failures.
One optional follow-up
The unhandledrejection listener (main.tsx:35) doesn't have a matching guard. In practice, ResizeObserver loop notifications fire as window-error events, not as promise rejections — so this isn't a real source of leakage. But if anyone wraps ResizeObserver in a promise abstraction in the future (or if a library does so under the hood), the noise would resurface there. Optional defense-in-depth: add the same if (...includes("ResizeObserver loop")) return; guard to the rejection listener too. Not blocking; the current fix solves the actual problem.
— Rames Jusso
Summary
ResizeObserver loop completed with undelivered notifications.errors in the Studio global error handler — this is a benign browser-internal message (not a real bug) that was flooding telemetry with ~18,000 events/month, drowning out actionable errors.event.messagefor "ResizeObserver loop" at the top of thewindow.addEventListener("error", ...)handler and short-circuits withstopImmediatePropagation()+preventDefault()before reachingtrackStudioEvent.Test plan
unhandled_errortelemetry events are emitted for ResizeObserver loop messages.throw new Error("test")) — verify it still appears in telemetry asunhandled_error.preventDefault()).