v1.0.36: eliminate blue flash between setSettings and setState

setState was being called after setRunningEntry, which makes two
async global settings calls and takes ~1 second. During that time
the button sat in the blue reset state from setSettings. Now
setState is called immediately after setSettings, before
setRunningEntry, so the blue flash is imperceptibly brief.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
pdmarf
2026-04-24 09:13:38 +01:00
parent bb021633a3
commit 5cdc77ccf3
6 changed files with 12 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
const CURRENT_VERSION = "1.0.35";
const CURRENT_VERSION = "1.0.36";
const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild";
const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
@@ -237,9 +237,9 @@ class TimerToggle extends SingletonAction<TimerSettings> {
const stopped = { ...ev.payload.settings, activeEntryId: null };
await ev.action.setSettings(stopped);
this.settingsCache.set(ev.action.id, stopped);
await setRunningEntry(null);
// Re-assert after setSettings resets visual state
// Re-assert immediately — before setRunningEntry's async calls
await Promise.all([ev.action.setState(0), ev.action.setTitle(title)]);
await setRunningEntry(null);
} else {
const prevEntryId = await getRunningEntryId();
@@ -267,9 +267,9 @@ class TimerToggle extends SingletonAction<TimerSettings> {
const started = { ...ev.payload.settings, activeEntryId: entryId };
await ev.action.setSettings(started);
this.settingsCache.set(ev.action.id, started);
await setRunningEntry(entryId);
// Re-assert after setSettings resets visual state
// Re-assert immediately — before setRunningEntry's async calls
await Promise.all([ev.action.setState(1), ev.action.setTitle(`${title}`)]);
await setRunningEntry(entryId);
}
} catch (err) {
// Revert optimistic visual on error