v1.0.29: fix userId not restoring due to race condition
onSendToPropertyInspector (users list) arrives before onDidReceiveGlobalSettings (saved userId) in most cases, leaving globalUserId empty when populateUsers runs. Now cachedUsers stores the list, and onDidReceiveGlobalSettings re-populates if users already arrived — handles both orderings. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6438,7 +6438,7 @@ async function stopTimer(token, entryId) {
|
||||
}
|
||||
|
||||
// src/plugin.ts
|
||||
var CURRENT_VERSION = "1.0.28";
|
||||
var CURRENT_VERSION = "1.0.29";
|
||||
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=
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
©╬и$q
|
||||
PИэ╞
|
||||
йщJОЁ▀⌠Ы╚▓яU(д┘Ж░░8ДОЬMJv ё√шHАXаJ┌╗∙И╧OУнаzЛ╧CщеC╔/эУ6╩
|
||||
@@ -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.28",
|
||||
"Version": "1.0.29",
|
||||
"SDKVersion": 2,
|
||||
"Software": { "MinimumVersion": "5.0" },
|
||||
"OS": [{ "Platform": "mac", "MinimumVersion": "10.11" }],
|
||||
|
||||
@@ -162,6 +162,7 @@
|
||||
var credSaveTimer = null;
|
||||
var credConfigured = false;
|
||||
var globalUserId = "";
|
||||
var cachedUsers = [];
|
||||
|
||||
function setStatus(msg, cls) {
|
||||
var el = document.getElementById("statusText");
|
||||
@@ -201,15 +202,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
function populateUsers(users, savedUserId) {
|
||||
function populateUsers(users, userId) {
|
||||
cachedUsers = users;
|
||||
var sel = document.getElementById("userId");
|
||||
var current = savedUserId || sel.value;
|
||||
sel.innerHTML = '<option value="">— Select your name —</option>';
|
||||
users.forEach(function(u) {
|
||||
var opt = document.createElement("option");
|
||||
opt.value = u.id;
|
||||
opt.textContent = u.name;
|
||||
if (u.id === current) opt.selected = true;
|
||||
if (u.id === userId) opt.selected = true;
|
||||
sel.appendChild(opt);
|
||||
});
|
||||
}
|
||||
@@ -266,11 +267,9 @@
|
||||
var s = jsn.payload.settings || {};
|
||||
document.getElementById("notionToken").value = s.notionToken || "";
|
||||
globalUserId = s.userId || "";
|
||||
if (globalUserId) {
|
||||
var sel = document.getElementById("userId");
|
||||
if (sel.querySelector('option[value="' + globalUserId + '"]')) {
|
||||
sel.value = globalUserId;
|
||||
}
|
||||
if (globalUserId && cachedUsers.length > 0) {
|
||||
// Users already loaded — re-populate with correct selection
|
||||
populateUsers(cachedUsers, globalUserId);
|
||||
}
|
||||
|
||||
credConfigured = !!(s.notionToken && s.userId);
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
const CURRENT_VERSION = "1.0.28";
|
||||
const CURRENT_VERSION = "1.0.29";
|
||||
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=
|
||||
|
||||
@@ -1 +1 @@
|
||||
{ "version": "1.0.28" }
|
||||
{ "version": "1.0.29" }
|
||||
|
||||
Reference in New Issue
Block a user