mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-28 08:21:27 -03:00
fix(bulk): restore card selection when virtual scroller recreates cards
This commit is contained in:
@@ -543,8 +543,9 @@ export function createModelCard(model, modelType) {
|
||||
card.classList.add('excluded-model');
|
||||
}
|
||||
|
||||
// Apply selection state if in bulk mode and this card is in the selected set (LoRA only)
|
||||
if (modelType === MODEL_TYPES.LORA && state.bulkMode && state.selectedLoras.has(model.file_path)) {
|
||||
// state.selectedModels resolves to the active page's set (selectedLoras
|
||||
// included) - do not narrow this back to selectedLoras/LORA-only.
|
||||
if (state.bulkMode && state.selectedModels.has(model.file_path)) {
|
||||
card.classList.add('selected');
|
||||
}
|
||||
|
||||
|
||||
@@ -544,6 +544,12 @@ export class MasonryScroller {
|
||||
modelCard.style.minWidth = '0';
|
||||
}
|
||||
|
||||
// Scroll recycling rebuilds cards from scratch, dropping `.selected`
|
||||
// even though the filepath is still selected in state.
|
||||
if (state.bulkMode && modelCard && state.selectedModels.has(modelCard.dataset.filepath)) {
|
||||
modelCard.classList.add('selected');
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
|
||||
@@ -497,6 +497,12 @@ export class VirtualScroller {
|
||||
modelCard.style.minWidth = '0';
|
||||
}
|
||||
|
||||
// Scroll recycling rebuilds cards from scratch, dropping `.selected`
|
||||
// even though the filepath is still selected in state.
|
||||
if (state.bulkMode && modelCard && state.selectedModels.has(modelCard.dataset.filepath)) {
|
||||
modelCard.classList.add('selected');
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user