Fixed: Restoring scroll position when going back/forward to series list

This commit is contained in:
Mark McDowall 2023-01-08 15:17:34 -08:00 committed by Mark McDowall
parent d022679b7d
commit 5aad84dba4
1 changed files with 8 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection'; import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator'; import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper'; import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
import withScrollPosition from 'Components/withScrollPosition';
import { align, icons } from 'Helpers/Props'; import { align, icons } from 'Helpers/Props';
import SortDirection from 'Helpers/Props/SortDirection'; import SortDirection from 'Helpers/Props/SortDirection';
import NoSeries from 'Series/NoSeries'; import NoSeries from 'Series/NoSeries';
@ -48,7 +49,11 @@ function getViewComponent(view) {
return SeriesIndexTable; return SeriesIndexTable;
} }
function SeriesIndex() { interface SeriesIndexProps {
initialScrollTop?: number;
}
const SeriesIndex = withScrollPosition((props) => {
const { const {
isFetching, isFetching,
isPopulated, isPopulated,
@ -257,6 +262,7 @@ function SeriesIndex() {
ref={scrollerRef} ref={scrollerRef}
className={styles.contentBody} className={styles.contentBody}
innerClassName={styles[`${view}InnerContentBody`]} innerClassName={styles[`${view}InnerContentBody`]}
initialScrollTop={props.initialScrollTop}
onScroll={onScroll} onScroll={onScroll}
> >
{isFetching && !isPopulated ? <LoadingIndicator /> : null} {isFetching && !isPopulated ? <LoadingIndicator /> : null}
@ -301,6 +307,6 @@ function SeriesIndex() {
) : null} ) : null}
</PageContent> </PageContent>
); );
} }, 'seriesIndex');
export default SeriesIndex; export default SeriesIndex;