fix(launcher): optimistic update for display override button
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 <noreply@anthropic.com>
This commit is contained in:
@@ -737,11 +737,10 @@ function prevent_default<T extends Event>(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',
|
||||
|
||||
Reference in New Issue
Block a user