From 5eb82f8ff642fc3f1923152ff39b9e772f6f7daa Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Fri, 20 Mar 2026 22:24:17 +0100 Subject: [PATCH] fix: preserve saved combo value across load-order race When ProjectKey configures before ProjectSource, _getSourceLabels returns empty. replaceWithCombo now always keeps the saved value in the options list so it survives the race condition. Co-Authored-By: Claude Opus 4.6 --- web/project_key.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/project_key.js b/web/project_key.js index b908fe2..325daca 100644 --- a/web/project_key.js +++ b/web/project_key.js @@ -35,7 +35,11 @@ app.registerExtension({ const savedValue = oldWidget.value || ""; // Ensure values list is never empty (combo shows undefined otherwise) const comboValues = values.length > 0 ? values : [""]; - const defaultValue = comboValues.includes(savedValue) ? savedValue : comboValues[0]; + // Always preserve saved value — it may not be in the list yet (load-order race) + if (savedValue && !comboValues.includes(savedValue)) { + comboValues.unshift(savedValue); + } + const defaultValue = savedValue || comboValues[0]; // Remove old STRING widget node.widgets.splice(idx, 1); // Insert a real combo widget at the same position