fix: remove _refreshKeys from onMouseDown to prevent key reset
The async _refreshKeys call on every mouse click caused a race condition where clicking the key_name dropdown would trigger a re-fetch that overwrote the user's selection. Keys are now only refreshed on source label change and workflow load. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-3
@@ -200,7 +200,7 @@ app.registerExtension({
|
|||||||
app.graph?.setDirtyCanvas(true, true);
|
app.graph?.setDirtyCanvas(true, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- Sync + refresh on click (catches changes pushed from source) ---
|
// --- Sync config on click (lazy, no key refresh to avoid race) ---
|
||||||
const origOnMouseDown = nodeType.prototype.onMouseDown;
|
const origOnMouseDown = nodeType.prototype.onMouseDown;
|
||||||
nodeType.prototype.onMouseDown = function (e, localPos, graphCanvas) {
|
nodeType.prototype.onMouseDown = function (e, localPos, graphCanvas) {
|
||||||
origOnMouseDown?.apply(this, arguments);
|
origOnMouseDown?.apply(this, arguments);
|
||||||
@@ -208,9 +208,8 @@ app.registerExtension({
|
|||||||
if (srcWidget) {
|
if (srcWidget) {
|
||||||
srcWidget.options.values = this._getSourceLabels();
|
srcWidget.options.values = this._getSourceLabels();
|
||||||
}
|
}
|
||||||
// Always re-sync config from source and refresh keys on interaction
|
// Sync config values from source (synchronous, safe)
|
||||||
this._syncFromSource();
|
this._syncFromSource();
|
||||||
this._refreshKeys();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- Restore state on workflow load ---
|
// --- Restore state on workflow load ---
|
||||||
|
|||||||
Reference in New Issue
Block a user