mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
Enhance duplicate mode exit logic: hide duplicates banner, clear model grid, and re-enable virtual scrolling. Improve spacer element handling in VirtualScroller by recreating it if not found in the DOM.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
import { showToast } from '../utils/uiHelpers.js';
|
||||
import { RecipeCard } from './RecipeCard.js';
|
||||
import { state, getCurrentPageState } from '../state/index.js';
|
||||
import { initializeInfiniteScroll } from '../utils/infiniteScroll.js';
|
||||
|
||||
export class DuplicatesManager {
|
||||
constructor(recipeManager) {
|
||||
@@ -96,14 +95,7 @@ export class DuplicatesManager {
|
||||
}
|
||||
|
||||
// Re-enable virtual scrolling
|
||||
if (state.virtualScroller) {
|
||||
state.virtualScroller.enable();
|
||||
} else {
|
||||
// If virtual scroller doesn't exist, reinitialize it
|
||||
setTimeout(() => {
|
||||
initializeInfiniteScroll('recipes');
|
||||
}, 100);
|
||||
}
|
||||
state.virtualScroller.enable();
|
||||
}
|
||||
|
||||
renderDuplicateGroups() {
|
||||
|
||||
@@ -136,13 +136,23 @@ export class ModelDuplicatesManager {
|
||||
const pageState = getCurrentPageState();
|
||||
pageState.duplicatesMode = false;
|
||||
|
||||
// Check duplicates count again to update badge
|
||||
this.checkDuplicatesCount();
|
||||
// Hide duplicates banner
|
||||
const banner = document.getElementById('duplicatesBanner');
|
||||
if (banner) {
|
||||
banner.style.display = 'none';
|
||||
}
|
||||
|
||||
// Instead of trying to restore the virtual scroller,
|
||||
// simply redirect to reload the page
|
||||
// TODO: While this is a workaround rather than a deep fix, it's a pragmatic solution that will immediately resolve the issue for users. We can investigate the underlying cause more thoroughly later when there's time for more extensive debugging.
|
||||
window.location.href = `/${this.modelType}`;
|
||||
// Remove duplicate-mode class from the body
|
||||
document.body.classList.remove('duplicate-mode');
|
||||
|
||||
// Clear the model grid first
|
||||
const modelGrid = document.getElementById(this.modelType === 'loras' ? 'loraGrid' : 'checkpointGrid');
|
||||
if (modelGrid) {
|
||||
modelGrid.innerHTML = '';
|
||||
}
|
||||
|
||||
// Re-enable virtual scrolling
|
||||
state.virtualScroller.enable();
|
||||
}
|
||||
|
||||
renderDuplicateGroups() {
|
||||
|
||||
Reference in New Issue
Block a user