mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-21 03:01:27 -03:00
fix(ui): remove per-node active-filters chip from loras widgets
The indicator chip added for /activefilters discoverability was broken by design of its import path: AutocompleteTextWidget.vue imported web/comfyui/settings.js into the vue-widgets bundle, and settings.js's "../../scripts/app.js" import resolved at build time to the repo-root test shim (scripts/app.js, an in-memory settings store). The chip therefore read and wrote an orphaned in-memory Map: clicking it flipped only its own visual state and never touched the real ComfyUI setting that autocomplete.js consults (use_active_filters query param). Beyond the defect, a persistent per-node control for a global persisted setting misleads users and needs cross-instance sync machinery, which the footer hint, slash commands, right-click menu entry and settings dialog already cover. - AutocompleteTextWidget.vue: remove the chip button, its state/handlers, the settings.js import (the shim-inlining pathway) and all chip styles - AutocompleteTextWidget.test.ts: drop the chip indicator describe block and the settings.js module mock; beforeEach import no longer needed - settings.js: drop the lora-manager:setting-toggled window broadcast and its export — the chip was its only consumer, so every setLoraManagerSettingValue write no longer dispatches a dead event - autocomplete.activeFilters.test.js: drop the broadcast assertion test - loraLoader.activeFiltersMenu.test.js: drop SETTING_TOGGLED_EVENT_NAME from the settings.js mock Discoverability of /activefilters // /noactivefilters is unchanged: command-list footer, first-run hint, node context menu, settings dialog.
This commit is contained in:
@@ -175,42 +175,23 @@ const getPromptTagAutocompletePreference = (() => {
|
||||
/**
|
||||
* Persist a LoRA Manager setting through ComfyUI's setting API.
|
||||
* Returns true when the setting was written successfully.
|
||||
*
|
||||
* Every successful write broadcasts a "lora-manager:setting-toggled" window
|
||||
* event (see SETTING_TOGGLED_EVENT_NAME) so widgets mirroring the setting
|
||||
* (e.g. the active-filters indicator in the autocomplete text widget) stay in
|
||||
* sync with slash-command / context-menu toggles.
|
||||
*/
|
||||
const SETTING_TOGGLED_EVENT_NAME = "lora-manager:setting-toggled";
|
||||
|
||||
const setLoraManagerSettingValue = async (settingId, value) => {
|
||||
const settingManager = app?.extensionManager?.setting;
|
||||
if (settingManager && typeof settingManager.set === "function") {
|
||||
await settingManager.set(settingId, value);
|
||||
_notifySettingToggled(settingId, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
const setting = app?.ui?.settings?.settingsById?.[settingId];
|
||||
if (setting) {
|
||||
app.ui.settings.setSettingValue(settingId, value);
|
||||
_notifySettingToggled(settingId, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
const _notifySettingToggled = (settingId, value) => {
|
||||
try {
|
||||
window.dispatchEvent(new CustomEvent(SETTING_TOGGLED_EVENT_NAME, {
|
||||
detail: { settingId, value },
|
||||
}));
|
||||
} catch (error) {
|
||||
// Best-effort notification; ignore non-browser environments
|
||||
}
|
||||
};
|
||||
|
||||
const getAutocompleteAppendCommaPreference = (() => {
|
||||
let settingsUnavailableLogged = false;
|
||||
|
||||
@@ -617,7 +598,6 @@ app.registerExtension({
|
||||
export {
|
||||
PROMPT_TAG_AUTOCOMPLETE_SETTING_ID,
|
||||
LORA_ACTIVE_FILTERS_AUTOCOMPLETE_SETTING_ID,
|
||||
SETTING_TOGGLED_EVENT_NAME,
|
||||
getWheelSensitivity,
|
||||
getAutoPathCorrectionPreference,
|
||||
getAutocompleteAppendCommaPreference,
|
||||
|
||||
Reference in New Issue
Block a user