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 <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -35,7 +35,11 @@ app.registerExtension({
|
|||||||
const savedValue = oldWidget.value || "";
|
const savedValue = oldWidget.value || "";
|
||||||
// Ensure values list is never empty (combo shows undefined otherwise)
|
// Ensure values list is never empty (combo shows undefined otherwise)
|
||||||
const comboValues = values.length > 0 ? values : [""];
|
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
|
// Remove old STRING widget
|
||||||
node.widgets.splice(idx, 1);
|
node.widgets.splice(idx, 1);
|
||||||
// Insert a real combo widget at the same position
|
// Insert a real combo widget at the same position
|
||||||
|
|||||||
Reference in New Issue
Block a user