From 0845f1d14b4660ac5a2ef5cb70332024e360892c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sat, 31 Aug 2024 12:10:18 +0200 Subject: [PATCH] Update react-virtuoso MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-fe/package.json | 2 +- packages/pl-fe/src/components/scrollable-list.tsx | 7 +++++++ packages/pl-fe/yarn.lock | 8 ++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/pl-fe/package.json b/packages/pl-fe/package.json index bd633beae..5c96f94b6 100644 --- a/packages/pl-fe/package.json +++ b/packages/pl-fe/package.json @@ -160,7 +160,7 @@ "react-sparklines": "^1.7.0", "react-sticky-box": "^2.0.0", "react-swipeable-views": "^0.14.0", - "react-virtuoso": "^4.7.13", + "react-virtuoso": "^4.10.2", "redux": "^5.0.0", "redux-immutable": "^4.0.0", "redux-thunk": "^3.1.0", diff --git a/packages/pl-fe/src/components/scrollable-list.tsx b/packages/pl-fe/src/components/scrollable-list.tsx index 1fe122c24..c368ad47d 100644 --- a/packages/pl-fe/src/components/scrollable-list.tsx +++ b/packages/pl-fe/src/components/scrollable-list.tsx @@ -212,6 +212,12 @@ const ScrollableList = React.forwardRef(({ /** Figure out the initial index to scroll to. */ const initialIndex = useMemo(() => { if (showLoading) return 0; + if (typeof initialTopMostItemIndex === 'number') { + return { + align: 'center', + index: initialTopMostItemIndex, + }; + } if (initialTopMostItemIndex) return initialTopMostItemIndex; if (scrollData && history.action === 'POP') { @@ -231,6 +237,7 @@ const ScrollableList = React.forwardRef(({ id={id} useWindowScroll={useWindowScroll} data={data} + totalCount={data.length} startReached={onScrollToTop} endReached={handleEndReached} isScrolling={isScrolling => isScrolling && onScroll && onScroll()} diff --git a/packages/pl-fe/yarn.lock b/packages/pl-fe/yarn.lock index 267c29bbe..85772d2c3 100644 --- a/packages/pl-fe/yarn.lock +++ b/packages/pl-fe/yarn.lock @@ -9206,10 +9206,10 @@ react-transition-group@^2.2.1: prop-types "^15.6.2" react-lifecycles-compat "^3.0.4" -react-virtuoso@^4.7.13: - version "4.7.13" - resolved "https://registry.yarnpkg.com/react-virtuoso/-/react-virtuoso-4.7.13.tgz#58ac7c5386c1f1a00f0f83a60ecb2ebdfcab35be" - integrity sha512-rabPhipwJ8rdA6TDk1vdVqVoU6eOkWukqoC1pNQVBCsvjBvIeJMi9nO079s0L7EsRzAxFFQNahX+8vuuY4F1Qg== +react-virtuoso@^4.10.2: + version "4.10.2" + resolved "https://registry.yarnpkg.com/react-virtuoso/-/react-virtuoso-4.10.2.tgz#a27308a3c4cfeb24722032acc0b6a46055c26967" + integrity sha512-os6n9QKeKRF+8mnQR/vGy/xrFf6vXIzuaAVL54q5k2st2d5QIEwI+KDKaflMUmMvnDbPxf68bs+CF5bY3YI7qA== react@^18.0.0: version "18.2.0"