v1.0.34: fix both buttons showing green simultaneously

When pressing B while A was running, B went green immediately but A
stayed green until getGlobal()+getRunningEntryId() resolved. Now uses
settingsCache to turn off all running buttons in the same synchronous
pass as turning B on — no async gap where both appear active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
pdmarf
2026-04-24 09:07:55 +01:00
parent 2fd2b6ad8a
commit 93616d3a1a
6 changed files with 20 additions and 19 deletions

View File

@@ -6438,7 +6438,7 @@ async function stopTimer(token, entryId) {
}
// src/plugin.ts
var CURRENT_VERSION = "1.0.33";
var CURRENT_VERSION = "1.0.34";
var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild";
var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
@@ -6599,6 +6599,13 @@ var TimerToggle = class extends SingletonAction {
if (activeEntryId) {
await Promise.all([ev.action.setState(0), ev.action.setTitle(title)]);
} else {
for (const other of this.actions) {
if (other.id === ev.action.id) continue;
const otherSettings = this.settingsCache.get(other.id);
if (otherSettings?.activeEntryId) {
await Promise.all([other.setState(0), other.setTitle(buttonTitle(otherSettings.projectName || ""))]);
}
}
await Promise.all([ev.action.setState(1), ev.action.setTitle(`\u23F1 ${title}`)]);
}
}
@@ -6622,13 +6629,6 @@ var TimerToggle = class extends SingletonAction {
} else {
const prevEntryId = await getRunningEntryId();
if (prevEntryId) {
for (const other of this.actions) {
if (other.id === ev.action.id) continue;
const otherSettings = this.settingsCache.get(other.id);
if (otherSettings?.activeEntryId === prevEntryId) {
await Promise.all([other.setState(0), other.setTitle(buttonTitle(otherSettings.projectName || ""))]);
}
}
await stopTimer(global.notionToken, prevEntryId);
for (const other of this.actions) {
if (other.id === ev.action.id) continue;

View File

@@ -2,7 +2,7 @@
"Author": "Pete Marfleet",
"Description": "Toggle Notion time tracking for a project with a single button press.",
"Name": "Notion Timer",
"Version": "1.0.33",
"Version": "1.0.34",
"SDKVersion": 2,
"Software": { "MinimumVersion": "5.0" },
"OS": [{ "Platform": "mac", "MinimumVersion": "10.11" }],