mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 14:42:11 -03:00
refactor: centralize resetAndReload functionality in baseModelApi
This commit is contained in:
@@ -102,6 +102,7 @@ export class BulkManager {
|
||||
if (!state.bulkMode) {
|
||||
this.clearSelection();
|
||||
|
||||
// TODO: fix this, no DOM manipulation should be done here
|
||||
// Force a lightweight refresh of the cards to ensure proper display
|
||||
// This is less disruptive than a full resetAndReload()
|
||||
document.querySelectorAll('.lora-card').forEach(card => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { modalManager } from './ModalManager.js';
|
||||
import { showToast } from '../utils/uiHelpers.js';
|
||||
import { LoadingManager } from './LoadingManager.js';
|
||||
import { getModelApiClient } from '../api/baseModelApi.js';
|
||||
import { getModelApiClient, resetAndReload } from '../api/baseModelApi.js';
|
||||
import { getStorageItem, setStorageItem } from '../utils/storageHelpers.js';
|
||||
|
||||
export class DownloadManager {
|
||||
@@ -416,15 +416,7 @@ export class DownloadManager {
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger reload with folder update - use dynamic import based on model type
|
||||
const modelType = this.apiClient.modelType;
|
||||
if (modelType === 'loras') {
|
||||
const { resetAndReload } = await import('../api/loraApi.js');
|
||||
await resetAndReload(true);
|
||||
} else if (modelType === 'checkpoints') {
|
||||
const { resetAndReload } = await import('../api/checkpointApi.js');
|
||||
await resetAndReload(true);
|
||||
}
|
||||
await resetAndReload(true);
|
||||
|
||||
} catch (error) {
|
||||
showToast(error.message, 'error');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { modalManager } from './ModalManager.js';
|
||||
import { showToast } from '../utils/uiHelpers.js';
|
||||
import { state } from '../state/index.js';
|
||||
import { resetAndReload } from '../api/loraApi.js';
|
||||
import { resetAndReload } from '../api/baseModelApi.js';
|
||||
import { setStorageItem, getStorageItem } from '../utils/storageHelpers.js';
|
||||
import { DOWNLOAD_PATH_TEMPLATES, MAPPABLE_BASE_MODELS } from '../utils/constants.js';
|
||||
|
||||
@@ -664,7 +664,7 @@ export class SettingsManager {
|
||||
await window.recipeManager.loadRecipes();
|
||||
} else if (this.currentPage === 'checkpoints') {
|
||||
// Reload the checkpoints without updating folders
|
||||
await window.checkpointsManager.loadCheckpoints();
|
||||
await resetAndReload(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user