1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-26 22:56:23 -04:00

Fixed scrolling via jump list on series index

This commit is contained in:
Mark McDowall
2021-04-24 21:57:54 -07:00
parent 56a33e3b4c
commit 5d316ad7dc
4 changed files with 45 additions and 42 deletions
@@ -114,7 +114,6 @@ class SeriesIndexPosters extends Component {
items,
sortKey,
posterOptions,
jumpToCharacter,
isSmallScreen
} = this.props;
@@ -139,19 +138,6 @@ class SeriesIndexPosters extends Component {
// recomputeGridSize also forces Grid to discard its cache of rendered cells
this._grid.recomputeGridSize();
}
if (jumpToCharacter != null && jumpToCharacter !== prevProps.jumpToCharacter) {
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
if (this._grid && index != null) {
const row = Math.floor(index / columnCount);
this._grid.scrollToCell({
rowIndex: row,
columnIndex: 0
});
}
}
}
//
@@ -256,6 +242,7 @@ class SeriesIndexPosters extends Component {
const {
scroller,
items,
jumpToCharacter,
isSmallScreen
} = this.props;
@@ -281,6 +268,18 @@ class SeriesIndexPosters extends Component {
return <div />;
}
let finalScrollTop = scrollTop;
if (jumpToCharacter != null) {
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
if (index != null) {
const row = Math.floor(index / columnCount);
finalScrollTop = rowHeight * row;
}
}
return (
<div ref={registerChild}>
<Grid
@@ -294,7 +293,7 @@ class SeriesIndexPosters extends Component {
rowHeight={rowHeight}
width={width}
onScroll={onChildScroll}
scrollTop={scrollTop}
scrollTop={finalScrollTop}
overscanRowCount={2}
cellRenderer={this.cellRenderer}
scrollToAlignment={'start'}