mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
fix(autocomplete): resolve instability in Vue DOM mode and fix WanVideo node binding
- Fix infinite reinitialization loop by only validating stale widget.inputEl when it's actually in DOM - Improve findWidgetInputElement to specifically search for textarea for text widgets, avoiding mismatches with checkbox inputs on nodes like WanVideo Lora Select that have toggle switches - Add data-node-id based element search as primary strategy for better reliability across rendering modes - Fix autocomplete initialization to properly handle element DOM state transitions Fixes autocomplete failing after Canvas ↔ Vue DOM mode switches and WanVideo node always failing to trigger autocomplete. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -241,6 +241,27 @@ app.registerExtension({
|
||||
// Merge the loras data
|
||||
const mergedLoras = mergeLoras(node.widgets[0].value, existingLoras);
|
||||
node.lorasWidget.value = mergedLoras;
|
||||
|
||||
// Initialize autocomplete after DOM is fully rendered
|
||||
const inputWidget = node.inputWidget || node.widgets[0];
|
||||
if (inputWidget && !node.autocomplete) {
|
||||
const { setupInputWidgetWithAutocomplete } = await import("./utils.js");
|
||||
const modelType = "loras";
|
||||
const autocompleteOptions = {
|
||||
maxItems: 20,
|
||||
minChars: 1,
|
||||
debounceDelay: 200,
|
||||
};
|
||||
// Fix: Assign the enhanced callback to replace the original
|
||||
inputWidget.callback = setupInputWidgetWithAutocomplete(node, inputWidget, inputWidget.callback, modelType, autocompleteOptions);
|
||||
|
||||
// Eager initialization: trigger callback after short delay to ensure DOM is ready
|
||||
setTimeout(() => {
|
||||
if (!node.autocomplete && inputWidget.callback) {
|
||||
inputWidget.callback(inputWidget.value);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user