Skip to content

Commit

Permalink
perf(ui): suppress error events from ResizeObserver
Browse files Browse the repository at this point in the history
  • Loading branch information
skjsjhb committed Mar 1, 2025
1 parent b4ad542 commit 90fb09c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/renderer/components/ExceptionDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ export function ExceptionDisplay() {
const [isOpen, setOpen] = useState(false);

function handleException(ev: ErrorEvent | PromiseRejectionEvent) {
let e: unknown;
// @ts-expect-error Unclear property definition in error events
let e = ev.error || ev.reason || ev.message;

if ("error" in ev) {
e = ev.error;
} else {
e = ev.reason;
}
if (!shouldSuppressError(e)) return;

console.error("Received error event:");
console.error(e);
Expand Down Expand Up @@ -127,3 +124,8 @@ function restoreError(e: unknown) {

return e;
}

function shouldSuppressError(e: unknown): boolean {
// https://github.com/inokawa/virtua?tab=readme-ov-file#what-is-resizeobserver-loop-completed-with-undelivered-notifications-error
return e !== "ResizeObserver loop completed with undelivered notifications.";
}

0 comments on commit 90fb09c

Please sign in to comment.