fix: library crashing when 0 items are present

This commit is contained in:
kKaskak 2024-03-29 12:09:48 +02:00
parent 27c8263d8d
commit b9bc10498d

View file

@ -57,7 +57,7 @@ const Library = ({ model, urlParams, queryParams }) => {
}, [hasNextPage, loadNextPage]);
const onScroll = useOnScrollToBottom(onScrollToBottom, SCROLL_TO_BOTTOM_TRESHOLD);
React.useLayoutEffect(() => {
if (profile.auth !== null && library.selected && library.selected.request.page === 1) {
if (profile.auth !== null && library.selected && library.selected.request.page === 1 && library.catalog.length !== 0 ) {
scrollContainerRef.current.scrollTop = 0;
}
}, [profile.auth, library.selected]);