From fa3677b5dd8d7946fbfcdd19c9babc3ab871bf08 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 13 Mar 2024 18:15:56 +0100 Subject: [PATCH] refactor(Library): scrollTop effect condition --- src/routes/Library/Library.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/Library/Library.js b/src/routes/Library/Library.js index 7720bd828..e7af3a07d 100644 --- a/src/routes/Library/Library.js +++ b/src/routes/Library/Library.js @@ -59,10 +59,10 @@ const Library = ({ model, urlParams, queryParams }) => { }, [hasNextPage, loadNextPage]); const onScroll = useOnScrollToBottom(onScrollToBottom, SCROLL_TO_BOTTOM_TRESHOLD); React.useLayoutEffect(() => { - if (library.selected && library.selected.request.page === 1 && profile.auth !== null) { + if (profile.auth !== null && library.selected && library.selected.request.page === 1) { scrollContainerRef.current.scrollTop = 0; } - }, [library.selected]); + }, [profile.auth, library.selected]); return (