Fix layout

This commit is contained in:
Will Miao
2025-03-13 20:37:23 +08:00
parent e7233c147d
commit 0b0caa1142
11 changed files with 175 additions and 75 deletions

View File

@@ -1,16 +1,19 @@
import { state } from '../state/index.js';
import { loadMoreLoras } from '../api/loraApi.js';
import { debounce } from './debounce.js';
export function initializeInfiniteScroll() {
if (state.observer) {
state.observer.disconnect();
}
const debouncedLoadMore = debounce(loadMoreLoras, 200);
state.observer = new IntersectionObserver(
(entries) => {
const target = entries[0];
if (target.isIntersecting && !state.isLoading && state.hasMore) {
loadMoreLoras();
debouncedLoadMore();
}
},
{ threshold: 0.1 }