v1.0.28: fix name dropdown not restoring when switching buttons

onDidReceiveGlobalSettings fired before the users list was populated,
so the saved userId couldn't be selected. Now stored in globalUserId
variable and applied when populateUsers runs, regardless of order.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
pdmarf
2026-04-24 08:50:39 +01:00
parent 5426a388ba
commit c3add8da27
7 changed files with 12 additions and 10 deletions

View File

@@ -6438,7 +6438,7 @@ async function stopTimer(token, entryId) {
} }
// src/plugin.ts // src/plugin.ts
var CURRENT_VERSION = "1.0.27"; var CURRENT_VERSION = "1.0.28";
var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild"; var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild";
var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY----- var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4= MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=

View File

@@ -1 +1,2 @@
­=O<>Ü1Ú€p?9Q'ÙUžG¶f" óÜ?ìÇŸÔ$3ea¢æásÊÔí!0ÍZg»pÛùã:¯•]‚ôÊ : ©╬и$q
PИэ

View File

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

View File

@@ -161,6 +161,7 @@
var currentSettings = {}; var currentSettings = {};
var credSaveTimer = null; var credSaveTimer = null;
var credConfigured = false; var credConfigured = false;
var globalUserId = "";
function setStatus(msg, cls) { function setStatus(msg, cls) {
var el = document.getElementById("statusText"); var el = document.getElementById("statusText");
@@ -264,10 +265,11 @@
$PI.onDidReceiveGlobalSettings(function(jsn) { $PI.onDidReceiveGlobalSettings(function(jsn) {
var s = jsn.payload.settings || {}; var s = jsn.payload.settings || {};
document.getElementById("notionToken").value = s.notionToken || ""; document.getElementById("notionToken").value = s.notionToken || "";
if (s.userId) { globalUserId = s.userId || "";
if (globalUserId) {
var sel = document.getElementById("userId"); var sel = document.getElementById("userId");
if (sel.querySelector('option[value="' + s.userId + '"]')) { if (sel.querySelector('option[value="' + globalUserId + '"]')) {
sel.value = s.userId; sel.value = globalUserId;
} }
} }
@@ -306,8 +308,7 @@
document.getElementById("versionText").textContent = "v" + payload.version; document.getElementById("versionText").textContent = "v" + payload.version;
} }
if (payload.users) { if (payload.users) {
var savedUserId = document.getElementById("userId").value; populateUsers(payload.users, globalUserId);
populateUsers(payload.users, savedUserId);
} }
if (payload.error) { if (payload.error) {
setStatus(payload.error, "error"); setStatus(payload.error, "error");

Binary file not shown.

View File

@@ -1,4 +1,4 @@
const CURRENT_VERSION = "1.0.27"; const CURRENT_VERSION = "1.0.28";
const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild"; const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild";
const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY----- const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4= MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=

View File

@@ -1 +1 @@
{ "version": "1.0.27" } { "version": "1.0.28" }