From 5aad84dba453c42b4b5a9eac43deecf91a98f4f6 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 8 Jan 2023 15:17:34 -0800 Subject: [PATCH] Fixed: Restoring scroll position when going back/forward to series list --- frontend/src/Series/Index/SeriesIndex.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/Series/Index/SeriesIndex.tsx b/frontend/src/Series/Index/SeriesIndex.tsx index 138892b58..d3e229385 100644 --- a/frontend/src/Series/Index/SeriesIndex.tsx +++ b/frontend/src/Series/Index/SeriesIndex.tsx @@ -10,6 +10,7 @@ import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton'; import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection'; import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator'; import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper'; +import withScrollPosition from 'Components/withScrollPosition'; import { align, icons } from 'Helpers/Props'; import SortDirection from 'Helpers/Props/SortDirection'; import NoSeries from 'Series/NoSeries'; @@ -48,7 +49,11 @@ function getViewComponent(view) { return SeriesIndexTable; } -function SeriesIndex() { +interface SeriesIndexProps { + initialScrollTop?: number; +} + +const SeriesIndex = withScrollPosition((props) => { const { isFetching, isPopulated, @@ -257,6 +262,7 @@ function SeriesIndex() { ref={scrollerRef} className={styles.contentBody} innerClassName={styles[`${view}InnerContentBody`]} + initialScrollTop={props.initialScrollTop} onScroll={onScroll} > {isFetching && !isPopulated ? : null} @@ -301,6 +307,6 @@ function SeriesIndex() { ) : null} ); -} +}, 'seriesIndex'); export default SeriesIndex;