Merge PR #700: fix(client): report a rejected sidebar sync instead of failing silently

This commit is contained in:
HuanLinOTO committed 2026-10-01 17:08:55 +08:00
commit 931215f08f
1 file changed
+4 -2
+4 -2
View File
@@ -329,13 +329,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?.()