fix(widget): restore strength drag on lora entries and header

widget.value is a getter/setter that returns a new array on every read,
so handleStrengthDrag with updateWidget=false mutated a discarded copy.
Introduce __dragActive flag to suppress renderLoras in setValue during
drag, allowing mutations to persist through widget.value without
destroying the DOM. Use try-finally to guarantee flag cleanup.
This commit is contained in:
Will Miao
2026-07-23 08:31:34 +08:00
parent 7c8dc57d55
commit 7b8b778f83
2 changed files with 62 additions and 39 deletions

View File

@@ -751,7 +751,11 @@ export function addLorasWidget(node, name, opts, callback) {
}
}
renderLoras(widgetValue, widget);
// Skip DOM re-render during drag to preserve pointer capture and event listeners.
// The strength inputs are updated directly via the pointermove handler instead.
if (!widget.__dragActive) {
renderLoras(widgetValue, widget);
}
},
hideOnZoom: true,
selectOn: ['click', 'focus']