From b9bc10498d1b55464e5683adacd7be3a306a1ba2 Mon Sep 17 00:00:00 2001 From: kKaskak <117831817+kKaskak@users.noreply.github.com> Date: Fri, 29 Mar 2024 12:09:48 +0200 Subject: [PATCH] fix: library crashing when 0 items are present --- src/routes/Library/Library.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/Library/Library.js b/src/routes/Library/Library.js index 82fbfe437..8f22a0c00 100644 --- a/src/routes/Library/Library.js +++ b/src/routes/Library/Library.js @@ -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]);