fix: widgets disappear when reordering in SubgraphEditor properties panel

SubgraphEditor.vue reordered widgets via activeWidgets, a lossy computed
that resolves [nodeId, widgetName] tuples to widget objects then converts
back. When widgets can't be resolved (e.g. during graph mutations),
entries are silently dropped.

Fix by reordering proxyWidgets.value directly (the source of truth),
matching how TabSubgraphInputs.vue already handles this correctly.

Amp-Thread-ID: https://ampcode.com/threads/T-019c73f9-0348-715e-9ef1-f6add8677e27
This commit is contained in:
bymyself
2026-02-19 20:37:47 -08:00
parent 3a4c76bf98
commit f28ccf2b5f

View File

@@ -196,7 +196,7 @@ function setDraggableState() {
'.draggable-item'
)
draggableList.value.applyNewItemsOrder = function () {
const reorderedItems = []
const reorderedItems: HTMLElement[] = []
let oldPosition = -1
this.getAllItems().forEach((item, index) => {
@@ -212,17 +212,27 @@ function setDraggableState() {
reorderedItems[newIndex] = item
})
if (oldPosition === -1) {
console.error('[SubgraphEditor] draggableItem not found in items')
return
}
for (let index = 0; index < this.getAllItems().length; index++) {
const item = reorderedItems[index]
if (typeof item === 'undefined') {
reorderedItems[index] = this.draggableItem
reorderedItems[index] = this.draggableItem as HTMLElement
}
}
const newPosition = reorderedItems.indexOf(this.draggableItem)
const aw = activeWidgets.value
const [w] = aw.splice(oldPosition, 1)
aw.splice(newPosition, 0, w)
activeWidgets.value = aw
const newPosition = reorderedItems.indexOf(
this.draggableItem as HTMLElement
)
const pw = proxyWidgets.value
const [w] = pw.splice(oldPosition, 1)
pw.splice(newPosition, 0, w)
proxyWidgets.value = pw
triggerRef(proxyWidgets)
}
}
watch(filteredActive, () => {