mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user