v1.0.47: auto-refresh version display in property inspector after update

The version number shown in the PI only updates via the 'projects' push,
which only fires from onPropertyInspectorDidAppear (i.e. when a
different button is clicked, forcing the PI to re-appear). After
'Check for Updates' completes and the plugin process restarts, an
already-open PI kept showing the pre-update version indefinitely.

Two changes: send a final 'Updated to vX — restarting…' status right
before process.exit(0) so the update message doesn't hang on
'Updating…', and push sendProjectsToPI() once on every plugin startup
(after streamDeck.connect()) so a PI that survived the restart gets
the new version immediately instead of waiting for an unrelated button
click.
This commit is contained in:
pdmarf
2026-09-02 11:24:30 +01:00
parent 5b3ba8186c
commit 3a033679c8
5 changed files with 15 additions and 4 deletions
+8 -1
View File
@@ -1,4 +1,4 @@
const CURRENT_VERSION = "1.0.46";
const CURRENT_VERSION = "1.0.47";
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=
@@ -73,6 +73,7 @@ async function checkForUpdates(sendStatus?: (msg: string) => void): Promise<void
fs.writeFileSync(__filename, newCode);
streamDeck.logger.info(`Updated to ${version}, restarting…`);
sendStatus?.(`Updated to v${version} — restarting…`);
process.exit(0);
} catch (err) {
const msg = err instanceof Error ? err.message : String(err);
@@ -349,4 +350,10 @@ streamDeck.ui.onSendToPlugin<{ event: string; settings?: TimerSettings; token?:
streamDeck.connect();
// If a Property Inspector is already open (e.g. it survived the restart
// that just happened after an auto-update), push it the now-current
// version immediately — otherwise it keeps showing the pre-update number
// until the user happens to click a different button and reopens it.
sendProjectsToPI();
setTimeout(() => checkForUpdates(), 10_000);