mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-20 18:51:26 -03:00
fix(settings): restore the Other Models master toggle state on load
updateOtherModelsControls() synced the sub-type checkboxes and default-root selects but never set the master toggle's checked state, and the setting_toggle macro renders no checked attribute, so after a page refresh the toggle always appeared off regardless of the saved setting.
This commit is contained in:
@@ -2432,6 +2432,11 @@ export class SettingsManager {
|
|||||||
|| ['vae', 'upscaler', 'text_encoder']
|
|| ['vae', 'upscaler', 'text_encoder']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const masterToggle = document.getElementById('enableOtherModels');
|
||||||
|
if (masterToggle) {
|
||||||
|
masterToggle.checked = enableOtherModels;
|
||||||
|
}
|
||||||
|
|
||||||
document.querySelectorAll('[data-other-subtype-toggle]').forEach((input) => {
|
document.querySelectorAll('[data-other-subtype-toggle]').forEach((input) => {
|
||||||
input.checked = enabledSubTypes.has(input.value);
|
input.checked = enabledSubTypes.has(input.value);
|
||||||
input.disabled = !enableOtherModels;
|
input.disabled = !enableOtherModels;
|
||||||
|
|||||||
@@ -665,6 +665,22 @@ describe('SettingsManager other-model root selects', () => {
|
|||||||
expect(container.classList.contains('is-disabled')).toBe(false);
|
expect(container.classList.contains('is-disabled')).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('restores the master toggle checked state from settings', () => {
|
||||||
|
const manager = createManager();
|
||||||
|
const masterToggle = document.createElement('input');
|
||||||
|
masterToggle.type = 'checkbox';
|
||||||
|
masterToggle.id = 'enableOtherModels';
|
||||||
|
document.body.appendChild(masterToggle);
|
||||||
|
|
||||||
|
state.global.settings = { enable_other_models: true };
|
||||||
|
manager.updateOtherModelsControls();
|
||||||
|
expect(masterToggle.checked).toBe(true);
|
||||||
|
|
||||||
|
state.global.settings = { enable_other_models: false };
|
||||||
|
manager.updateOtherModelsControls();
|
||||||
|
expect(masterToggle.checked).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it('persists the checked sub_types as the whole allow-list', async () => {
|
it('persists the checked sub_types as the whole allow-list', async () => {
|
||||||
const manager = createManager();
|
const manager = createManager();
|
||||||
appendToggles('vae', 'upscaler', 'controlnet');
|
appendToggles('vae', 'upscaler', 'controlnet');
|
||||||
|
|||||||
Reference in New Issue
Block a user