v1.0.37: send setSettings and setState simultaneously to avoid flash
Previously setSettings was awaited first (causing blue flash), then setState was called. Now both are sent in the same Promise.all so Stream Deck processes setState in the same batch, overriding the visual reset from setSettings with no visible blue transition. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const CURRENT_VERSION = "1.0.36";
|
||||
const CURRENT_VERSION = "1.0.37";
|
||||
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=
|
||||
@@ -235,10 +235,9 @@ class TimerToggle extends SingletonAction<TimerSettings> {
|
||||
if (activeEntryId) {
|
||||
await stopTimer(global.notionToken, activeEntryId);
|
||||
const stopped = { ...ev.payload.settings, activeEntryId: null };
|
||||
await ev.action.setSettings(stopped);
|
||||
this.settingsCache.set(ev.action.id, stopped);
|
||||
// Re-assert immediately — before setRunningEntry's async calls
|
||||
await Promise.all([ev.action.setState(0), ev.action.setTitle(title)]);
|
||||
// setSettings and setState together so the state reset doesn't flash
|
||||
await Promise.all([ev.action.setSettings(stopped), ev.action.setState(0), ev.action.setTitle(title)]);
|
||||
await setRunningEntry(null);
|
||||
} else {
|
||||
const prevEntryId = await getRunningEntryId();
|
||||
@@ -251,8 +250,8 @@ class TimerToggle extends SingletonAction<TimerSettings> {
|
||||
const otherSettings = this.settingsCache.get(other.id);
|
||||
if (otherSettings?.activeEntryId === prevEntryId) {
|
||||
const stopped = { ...otherSettings, activeEntryId: null };
|
||||
await other.setSettings(stopped);
|
||||
this.settingsCache.set(other.id, stopped);
|
||||
await Promise.all([other.setSettings(stopped), other.setState(0), other.setTitle(buttonTitle(otherSettings.projectName || ""))]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -265,10 +264,9 @@ class TimerToggle extends SingletonAction<TimerSettings> {
|
||||
global.userId,
|
||||
);
|
||||
const started = { ...ev.payload.settings, activeEntryId: entryId };
|
||||
await ev.action.setSettings(started);
|
||||
this.settingsCache.set(ev.action.id, started);
|
||||
// Re-assert immediately — before setRunningEntry's async calls
|
||||
await Promise.all([ev.action.setState(1), ev.action.setTitle(`⏱ ${title}`)]);
|
||||
// setSettings and setState together so the state reset doesn't flash
|
||||
await Promise.all([ev.action.setSettings(started), ev.action.setState(1), ev.action.setTitle(`⏱ ${title}`)]);
|
||||
await setRunningEntry(entryId);
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user