v1.0.46: clear stale running-timer state even when stopTimer fails in Notion
The onKeyDown stop/switch paths only cleared memRunningActionId/EntryId after a successful stopTimer call. If the tracked Notion entry was already gone (archived/deleted/edited outside the plugin), stopTimer threw and the stale ID was never cleared -- every subsequent keypress retried the same doomed stop call, showed a warning triangle, and the deck got permanently stuck (unable to unselect the stuck button or start any new timer). checkElapsed already handled this correctly by clearing state unconditionally; onKeyDown now does the same: stopTimer failures are logged but non-fatal, and local state clears regardless.
This commit is contained in:
@@ -6438,7 +6438,7 @@ async function stopTimer(token, entryId) {
|
||||
}
|
||||
|
||||
// src/plugin.ts
|
||||
var CURRENT_VERSION = "1.0.45";
|
||||
var CURRENT_VERSION = "1.0.46";
|
||||
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=
|
||||
@@ -6677,13 +6677,21 @@ var TimerToggle = class extends SingletonAction {
|
||||
}
|
||||
try {
|
||||
if (isRunning) {
|
||||
await stopTimer(global.notionToken, memRunningEntryId);
|
||||
try {
|
||||
await stopTimer(global.notionToken, memRunningEntryId);
|
||||
} catch (err) {
|
||||
plugin_default.logger.error("Failed to stop timer in Notion (clearing local state anyway):", err);
|
||||
}
|
||||
setRunningEntry(null, null);
|
||||
this.clearElapsedCheck();
|
||||
await Promise.all([ev.action.setState(0), ev.action.setTitle(title)]);
|
||||
} else {
|
||||
if (memRunningEntryId) {
|
||||
await stopTimer(global.notionToken, memRunningEntryId);
|
||||
try {
|
||||
await stopTimer(global.notionToken, memRunningEntryId);
|
||||
} catch (err) {
|
||||
plugin_default.logger.error("Failed to stop previous timer in Notion (clearing local state anyway):", err);
|
||||
}
|
||||
setRunningEntry(null, null);
|
||||
this.clearElapsedCheck();
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
696’``w¾)G¶"éoÛ£šAyÍ‹xìØ“ÁÞ¶á„ÙdG»Cv+t9ãXÅü]M>IÁ¨Í–¼š²ßÁ
|
||||
%тC╧K$Яh╜╦Oвы~┘▒cc╗'cwMА▐╦Чю⌡╦\чщAД╗▐ty"0|иiНbRЖ╩/нЕ└/║
|
||||
Binary file not shown.
+15
-3
@@ -1,4 +1,4 @@
|
||||
const CURRENT_VERSION = "1.0.45";
|
||||
const CURRENT_VERSION = "1.0.46";
|
||||
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=
|
||||
@@ -286,13 +286,25 @@ class TimerToggle extends SingletonAction<TimerSettings> {
|
||||
|
||||
try {
|
||||
if (isRunning) {
|
||||
await stopTimer(global.notionToken, memRunningEntryId!);
|
||||
// Stopping the entry in Notion is best-effort: if the page is already
|
||||
// gone/archived (e.g. edited outside the plugin) this throws, but the
|
||||
// local "running" tracking must clear anyway or every future keypress
|
||||
// retries this same doomed stop call and the deck gets stuck forever.
|
||||
try {
|
||||
await stopTimer(global.notionToken, memRunningEntryId!);
|
||||
} catch (err) {
|
||||
streamDeck.logger.error("Failed to stop timer in Notion (clearing local state anyway):", err);
|
||||
}
|
||||
setRunningEntry(null, null);
|
||||
this.clearElapsedCheck();
|
||||
await Promise.all([ev.action.setState(0), ev.action.setTitle(title)]);
|
||||
} else {
|
||||
if (memRunningEntryId) {
|
||||
await stopTimer(global.notionToken, memRunningEntryId);
|
||||
try {
|
||||
await stopTimer(global.notionToken, memRunningEntryId);
|
||||
} catch (err) {
|
||||
streamDeck.logger.error("Failed to stop previous timer in Notion (clearing local state anyway):", err);
|
||||
}
|
||||
setRunningEntry(null, null);
|
||||
this.clearElapsedCheck();
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{ "version": "1.0.45" }
|
||||
{ "version": "1.0.46" }
|
||||
|
||||
Reference in New Issue
Block a user