From a26ea8b49ca3c60a24eb1a5c9d20acf1170c5dbe Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Fri, 22 May 2026 14:18:58 -0400 Subject: [PATCH] fix(launcher): optimistic update for display override button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this, the button depended on the liveQuery round-trip to show the new state — invisible on stale IDB caches that predate the cfg_json properties_to_save fix. Now mutates event_file_obj locally on click so the button reflects the new state immediately, with the background refresh as confirmation. Co-Authored-By: Claude Sonnet 4.6 --- .../events/[event_id]/(launcher)/launcher_file_cont.svelte | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte b/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte index 05f1a1e4..00be4aa4 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte @@ -737,11 +737,10 @@ function prevent_default(fn: (event: T) => void) { type="button" onclick={async () => { const cur = event_file_obj?.cfg_json?.display_override ?? null; - let next: string | null; - if (!cur) next = 'extend'; - else if (cur === 'extend') next = 'mirror'; - else next = null; + const next: string | null = !cur ? 'extend' : cur === 'extend' ? 'mirror' : null; const new_cfg = { ...(event_file_obj.cfg_json ?? {}), display_override: next }; + // Optimistic update — don't wait for the liveQuery round-trip + event_file_obj = { ...event_file_obj, cfg_json: new_cfg }; await api.update_ae_obj({ api_cfg: $ae_api, obj_type: 'event_file',