From 413e1c09e9717005c46e87e76385c588fbeb4c1c Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Fri, 20 Mar 2026 20:46:50 +0100 Subject: [PATCH] fix: ProjectKey pulls fresh data on click, add debug logging ProjectKey onMouseDown now triggers _syncFromSource + _refreshKeys so clicking a relay always picks up source config changes. Added console logs to notifyRelays and _refreshKeys for diagnosing sync issues. Co-Authored-By: Claude Opus 4.6 --- web/project_key.js | 11 +++++++++-- web/project_source.js | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/web/project_key.js b/web/project_key.js index 7a560bf..f819416 100644 --- a/web/project_key.js +++ b/web/project_key.js @@ -136,7 +136,11 @@ app.registerExtension({ const fileW = this.widgets?.find(w => w.name === "file_name"); const seqW = this.widgets?.find(w => w.name === "sequence_number"); - if (!urlW?.value || !projW?.value || !fileW?.value) return; + console.log(`[ProjectKey] _refreshKeys id=${this.id}: url="${urlW?.value}" project="${projW?.value}" file="${fileW?.value}" seq=${seqW?.value}`); + if (!urlW?.value || !projW?.value || !fileW?.value) { + console.log(`[ProjectKey] _refreshKeys: skipped (missing config)`); + return; + } try { const resp = await api.fetchApi( @@ -190,7 +194,7 @@ app.registerExtension({ app.graph?.setDirtyCanvas(true, true); }; - // --- Populate source dropdown on click (lazy refresh) --- + // --- Sync + refresh on click (catches changes pushed from source) --- const origOnMouseDown = nodeType.prototype.onMouseDown; nodeType.prototype.onMouseDown = function (e, localPos, graphCanvas) { origOnMouseDown?.apply(this, arguments); @@ -198,6 +202,9 @@ app.registerExtension({ if (srcWidget) { srcWidget.options.values = this._getSourceLabels(); } + // Always re-sync config from source and refresh keys on interaction + this._syncFromSource(); + this._refreshKeys(); }; // --- Restore state on workflow load --- diff --git a/web/project_source.js b/web/project_source.js index 0c11068..8f232cb 100644 --- a/web/project_source.js +++ b/web/project_source.js @@ -11,15 +11,20 @@ app.registerExtension({ if (!sourceNode.graph?._nodes) return; const labelW = sourceNode.widgets?.find(w => w.name === "label"); if (!labelW?.value) return; + console.log(`[ProjectSource] notifyRelays: label="${labelW.value}", scanning ${sourceNode.graph._nodes.length} nodes`); + let matched = 0; for (const node of sourceNode.graph._nodes) { if (node.type === "ProjectKey" && node._syncFromSource && node._refreshKeys) { const srcW = node.widgets?.find(w => w.name === "source_label"); + console.log(`[ProjectSource] ProjectKey id=${node.id} source_label="${srcW?.value}"`); if (srcW?.value === labelW.value) { + matched++; node._syncFromSource(); node._refreshKeys(); } } } + console.log(`[ProjectSource] notifyRelays: matched ${matched} relays`); } const origOnNodeCreated = nodeType.prototype.onNodeCreated;