Fixed: restoring scroll position when going back to index page

This commit is contained in:
ta264
2021-05-13 21:15:11 +01:00
parent 129591de61
commit 93f0f33e84
9 changed files with 54 additions and 9 deletions
@@ -112,7 +112,8 @@ class AuthorIndexBanners extends Component {
items,
sortKey,
bannerOptions,
jumpToCharacter
jumpToCharacter,
scrollTop
} = this.props;
const {
@@ -149,6 +150,10 @@ class AuthorIndexBanners extends Component {
});
}
}
if (this._grid && scrollTop !== 0) {
this._grid.scrollToPosition({ scrollTop });
}
}
//
@@ -306,6 +311,7 @@ AuthorIndexBanners.propTypes = {
sortKey: PropTypes.string,
bannerOptions: PropTypes.object.isRequired,
jumpToCharacter: PropTypes.string,
scrollTop: PropTypes.number.isRequired,
scroller: PropTypes.instanceOf(Element).isRequired,
showRelativeDates: PropTypes.bool.isRequired,
shortDateFormat: PropTypes.string.isRequired,
@@ -71,7 +71,8 @@ class AuthorIndexOverviews extends Component {
items,
sortKey,
overviewOptions,
jumpToCharacter
jumpToCharacter,
scrollTop
} = this.props;
const {
@@ -103,6 +104,10 @@ class AuthorIndexOverviews extends Component {
});
}
}
if (this._grid && scrollTop !== 0) {
this._grid.scrollToPosition({ scrollTop });
}
}
//
@@ -114,7 +114,8 @@ class AuthorIndexPosters extends Component {
sortKey,
posterOptions,
jumpToCharacter,
isSmallScreen
isSmallScreen,
scrollTop
} = this.props;
const {
@@ -151,6 +152,10 @@ class AuthorIndexPosters extends Component {
});
}
}
if (this._grid && scrollTop !== 0) {
this._grid.scrollToPosition({ scrollTop });
}
}
//
@@ -314,6 +319,7 @@ AuthorIndexPosters.propTypes = {
sortKey: PropTypes.string,
posterOptions: PropTypes.object.isRequired,
jumpToCharacter: PropTypes.string,
scrollTop: PropTypes.number.isRequired,
scroller: PropTypes.instanceOf(Element).isRequired,
showRelativeDates: PropTypes.bool.isRequired,
shortDateFormat: PropTypes.string.isRequired,
@@ -83,7 +83,8 @@ class AuthorIndexTable extends Component {
showBanners,
isSmallScreen,
onSortPress,
scroller
scroller,
scrollTop
} = this.props;
return (
@@ -91,6 +92,7 @@ class AuthorIndexTable extends Component {
className={styles.tableContainer}
items={items}
scrollIndex={this.state.scrollIndex}
scrollTop={scrollTop}
isSmallScreen={isSmallScreen}
scroller={scroller}
rowHeight={showBanners ? 70 : 38}
@@ -120,6 +122,7 @@ AuthorIndexTable.propTypes = {
sortDirection: PropTypes.oneOf(sortDirections.all),
showBanners: PropTypes.bool.isRequired,
jumpToCharacter: PropTypes.string,
scrollTop: PropTypes.number,
scroller: PropTypes.instanceOf(Element).isRequired,
isSmallScreen: PropTypes.bool.isRequired,
onSortPress: PropTypes.func.isRequired