fix(ui): in-page browse virtual lists and cover load priority (#783)

* fix(ui): in-page browse virtual lists and cover load priority

Align virtualizer scrollMargin with the in-page scroll viewport so
artist/album rows do not vanish on deep scroll after #731. Resolve
CachedImage IntersectionObserver root to the nearest scrolling pane so
network fetch slots favor visible covers; throttle Artists infinite scroll
to one page per visibleCount update.

* chore(release): CHANGELOG and credits for PR #783
This commit is contained in:
cucadmuh
2026-05-18 21:30:36 +03:00
committed by GitHub
parent 70c2fdfbf9
commit f6fe1484a9
10 changed files with 112 additions and 20 deletions
+10 -3
View File
@@ -40,16 +40,23 @@ export function useArtistsInfiniteScroll({
const [loadingMore, setLoadingMore] = useState(false);
const loadMoreRef = useRef<() => void>(() => {});
const observerInst = useRef<IntersectionObserver | null>(null);
/** Blocks overlapping sentinel callbacks until `visibleCount` commits. */
const loadPendingRef = useRef(false);
const loadMore = useCallback(() => {
if (loadingMore) return;
if (loadPendingRef.current) return;
loadPendingRef.current = true;
setLoadingMore(true);
setVisibleCount(prev => prev + pageSize);
setTimeout(() => setLoadingMore(false), 100);
}, [loadingMore, pageSize]);
}, [pageSize]);
loadMoreRef.current = loadMore;
useEffect(() => {
loadPendingRef.current = false;
setLoadingMore(false);
}, [visibleCount]);
useEffect(() => {
setVisibleCount(pageSize);
// resetDeps is intentionally spread into the dep array.