From e5a8b5faf58b9c6657ae53f3d8ee3fd2d6ba4e89 Mon Sep 17 00:00:00 2001 From: joyyoung <11570946+joyyoung@users.noreply.github.com> Date: Thu, 17 Sep 2026 15:26:26 +0800 Subject: [PATCH] fix(client): report a rejected sidebar sync instead of failing silently The mount effect calls void sync() at boot and again on every settings/document-updated replay. sync() runs setPrefs() and then mount(), so any throw in that chain rejects the promise with no fail() log, no error strip and no cleanup line: the panel simply never mounts and the bottom toggle stays dead. Seen in the wild across plugins: the native right-sidebar registry throws 'sidebarRight: tab kind ... is already registered (extension)', the throw escapes through a store listener, setPrefs rejects and the whole sidebar disappears without a single log line. Listener isolation (PR #652) covers that entry point; this catch keeps every other sync() rejection visible on the same last-resort strip the mount path already uses. --- src/client/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client/index.tsx b/src/client/index.tsx index d5c82a3c..da297a9a 100644 --- a/src/client/index.tsx +++ b/src/client/index.tsx @@ -340,13 +340,15 @@ export function apply(ctx: Context): void { if (decision?.suspended) unmount() else mount() } - void sync() + // setPrefs and mount() run inside sync(); a rejection there would leave + // the sidebar unmounted with a dead toggle as its only symptom. + void sync().catch((error) => { fail('sync', error) }) // Live re-evaluation: the runtime broadcasts settings-document updates // (the aionui card saves through the same document). Best effort — // deployments without the 'remote' service fall back to boot-time // evaluation only. const remote = ctx.get('remote') as { $on?: (event: string, listener: () => void) => () => void } | undefined - const offRemote = remote?.$on?.('settings/document-updated', () => { void sync() }) + const offRemote = remote?.$on?.('settings/document-updated', () => { void sync().catch((error) => { fail('sync', error) }) }) return () => { disposed = true offRemote?.()