mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
Fix infinite scroll
This commit is contained in:
@@ -275,11 +275,7 @@ export function appendLoraCards(loras) {
|
|||||||
|
|
||||||
loras.forEach(lora => {
|
loras.forEach(lora => {
|
||||||
const card = createLoraCard(lora);
|
const card = createLoraCard(lora);
|
||||||
if (sentinel) {
|
grid.appendChild(card);
|
||||||
grid.insertBefore(card, sentinel);
|
|
||||||
} else {
|
|
||||||
grid.appendChild(card);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -171,22 +171,6 @@ class RecipeManager {
|
|||||||
const recipeCard = new RecipeCard(recipe, (recipe) => this.showRecipeDetails(recipe));
|
const recipeCard = new RecipeCard(recipe, (recipe) => this.showRecipeDetails(recipe));
|
||||||
grid.appendChild(recipeCard.element);
|
grid.appendChild(recipeCard.element);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add sentinel for infinite scroll if needed
|
|
||||||
if (this.pageState.hasMore) {
|
|
||||||
let sentinel = document.getElementById('scroll-sentinel');
|
|
||||||
if (!sentinel) {
|
|
||||||
sentinel = document.createElement('div');
|
|
||||||
sentinel.id = 'scroll-sentinel';
|
|
||||||
sentinel.style.height = '10px';
|
|
||||||
grid.appendChild(sentinel);
|
|
||||||
|
|
||||||
// Re-observe the sentinel if we have an observer
|
|
||||||
if (state && state.observer) {
|
|
||||||
state.observer.observe(sentinel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showRecipeDetails(recipe) {
|
showRecipeDetails(recipe) {
|
||||||
|
|||||||
@@ -65,10 +65,24 @@ export function initializeInfiniteScroll(pageType = 'loras') {
|
|||||||
if (existingSentinel) {
|
if (existingSentinel) {
|
||||||
state.observer.observe(existingSentinel);
|
state.observer.observe(existingSentinel);
|
||||||
} else {
|
} else {
|
||||||
|
// Create a wrapper div that will be placed after the grid
|
||||||
|
const sentinelWrapper = document.createElement('div');
|
||||||
|
sentinelWrapper.style.width = '100%';
|
||||||
|
sentinelWrapper.style.height = '10px';
|
||||||
|
sentinelWrapper.style.margin = '0';
|
||||||
|
sentinelWrapper.style.padding = '0';
|
||||||
|
|
||||||
|
// Create the actual sentinel element
|
||||||
const sentinel = document.createElement('div');
|
const sentinel = document.createElement('div');
|
||||||
sentinel.id = 'scroll-sentinel';
|
sentinel.id = 'scroll-sentinel';
|
||||||
sentinel.style.height = '10px';
|
sentinel.style.height = '10px';
|
||||||
grid.appendChild(sentinel);
|
|
||||||
|
// Add the sentinel to the wrapper
|
||||||
|
sentinelWrapper.appendChild(sentinel);
|
||||||
|
|
||||||
|
// Insert the wrapper after the grid instead of inside it
|
||||||
|
grid.parentNode.insertBefore(sentinelWrapper, grid.nextSibling);
|
||||||
|
|
||||||
state.observer.observe(sentinel);
|
state.observer.observe(sentinel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<div class="search-container">
|
|
||||||
<input type="text" id="searchInput" placeholder="Search...">
|
|
||||||
<button id="searchButton"><i class="fas fa-search"></i></button>
|
|
||||||
</div>
|
|
||||||
Reference in New Issue
Block a user