Fixed: Jumpbar after going back to artist index page

This commit is contained in:
ta264
2021-05-13 21:15:11 +01:00
parent 93f0f33e84
commit 36080d4665
4 changed files with 36 additions and 23 deletions
@@ -100,7 +100,8 @@ class AuthorIndexPosters extends Component {
columnCount: 1,
posterWidth: 238,
posterHeight: 238,
rowHeight: calculateRowHeight(238, null, props.isSmallScreen, {})
rowHeight: calculateRowHeight(238, null, props.isSmallScreen, {}),
scrollRestored: false
};
this._isInitialized = false;
@@ -122,7 +123,8 @@ class AuthorIndexPosters extends Component {
width,
columnWidth,
columnCount,
rowHeight
rowHeight,
scrollRestored
} = this.state;
if (prevProps.sortKey !== sortKey ||
@@ -140,6 +142,11 @@ class AuthorIndexPosters extends Component {
this._grid.recomputeGridSize();
}
if (this._grid && scrollTop !== 0 && !scrollRestored) {
this.setState({ scrollRestored: true });
this._grid.scrollToPosition({ scrollTop });
}
if (jumpToCharacter != null && jumpToCharacter !== prevProps.jumpToCharacter) {
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
@@ -152,10 +159,6 @@ class AuthorIndexPosters extends Component {
});
}
}
if (this._grid && scrollTop !== 0) {
this._grid.scrollToPosition({ scrollTop });
}
}
//