Fixed: Jumpbar after going back to artist index page

pull/2732/head
ta264 3 years ago
parent 70342a6d29
commit a820f3d3ca

@ -100,7 +100,8 @@ class ArtistIndexBanners extends Component {
columnCount: 1,
bannerWidth: 476,
bannerHeight: 88,
rowHeight: calculateRowHeight(88, null, props.isSmallScreen, {})
rowHeight: calculateRowHeight(88, null, props.isSmallScreen, {}),
scrollRestored: false
};
this._isInitialized = false;
@ -120,7 +121,8 @@ class ArtistIndexBanners extends Component {
width,
columnWidth,
columnCount,
rowHeight
rowHeight,
scrollRestored
} = this.state;
if (prevProps.sortKey !== sortKey ||
@ -138,6 +140,11 @@ class ArtistIndexBanners 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);
@ -151,9 +158,6 @@ class ArtistIndexBanners extends Component {
}
}
if (this._grid && scrollTop !== 0) {
this._grid.scrollToPosition({ scrollTop });
}
}
//

@ -60,7 +60,8 @@ class ArtistIndexOverviews extends Component {
columnCount: 1,
posterWidth: 238,
posterHeight: 238,
rowHeight: calculateRowHeight(238, null, props.isSmallScreen, {})
rowHeight: calculateRowHeight(238, null, props.isSmallScreen, {}),
scrollRestored: false
};
this._grid = null;
@ -77,7 +78,8 @@ class ArtistIndexOverviews extends Component {
const {
width,
rowHeight
rowHeight,
scrollRestored
} = this.state;
if (prevProps.sortKey !== sortKey ||
@ -93,6 +95,11 @@ class ArtistIndexOverviews 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);
@ -104,10 +111,6 @@ class ArtistIndexOverviews extends Component {
});
}
}
if (this._grid && scrollTop !== 0) {
this._grid.scrollToPosition({ scrollTop });
}
}
//

@ -100,7 +100,8 @@ class ArtistIndexPosters 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 ArtistIndexPosters extends Component {
width,
columnWidth,
columnCount,
rowHeight
rowHeight,
scrollRestored
} = this.state;
if (prevProps.sortKey !== sortKey ||
@ -140,6 +142,11 @@ class ArtistIndexPosters 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 ArtistIndexPosters extends Component {
});
}
}
if (this._grid && scrollTop !== 0) {
this._grid.scrollToPosition({ scrollTop });
}
}
//

@ -37,7 +37,8 @@ class VirtualTable extends Component {
super(props, context);
this.state = {
width: 0
width: 0,
scrollRestored: false
};
this._grid = null;
@ -52,7 +53,8 @@ class VirtualTable extends Component {
} = this.props;
const {
width
width,
scrollRestored
} = this.state;
if (this._grid &&
@ -63,16 +65,17 @@ class VirtualTable extends Component {
this._grid.recomputeGridSize();
}
if (this._grid && scrollTop !== undefined && scrollTop !== 0 && !scrollRestored) {
this.setState({ scrollRestored: true });
this._grid.scrollToPosition({ scrollTop });
}
if (scrollIndex != null && scrollIndex !== prevProps.scrollIndex) {
this._grid.scrollToCell({
rowIndex: scrollIndex,
columnIndex: 0
});
}
if (this._grid && scrollTop !== undefined && scrollTop !== 0) {
this._grid.scrollToPosition({ scrollTop });
}
}
//

Loading…
Cancel
Save