[Glitch] Fix “slow mode” issues
Port f109867578
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
@ -153,7 +153,9 @@ export default class ScrollableList extends PureComponent {
|
||||
const someItemInserted = React.Children.count(prevProps.children) > 0 &&
|
||||
React.Children.count(prevProps.children) < React.Children.count(this.props.children) &&
|
||||
this.getFirstChildKey(prevProps) !== this.getFirstChildKey(this.props);
|
||||
if (someItemInserted && (this.node.scrollTop > 0 || this.mouseMovedRecently)) {
|
||||
const pendingChanged = (prevProps.numPending > 0) !== (this.props.numPending > 0);
|
||||
|
||||
if (pendingChanged || someItemInserted && (this.node.scrollTop > 0 || this.mouseMovedRecently)) {
|
||||
return this.node.scrollHeight - this.node.scrollTop;
|
||||
} else {
|
||||
return null;
|
||||
@ -228,6 +230,13 @@ export default class ScrollableList extends PureComponent {
|
||||
handleLoadPending = e => {
|
||||
e.preventDefault();
|
||||
this.props.onLoadPending();
|
||||
// Prevent the weird scroll-jumping behavior, as we explicitly don't want to
|
||||
// scroll to top, and we know the scroll height is going to change
|
||||
this.scrollToTopOnMouseIdle = false;
|
||||
this.lastScrollWasSynthetic = false;
|
||||
this.clearMouseIdleTimer();
|
||||
this.mouseIdleTimer = setTimeout(this.handleMouseIdle, MOUSE_IDLE_DELAY);
|
||||
this.mouseMovedRecently = true;
|
||||
}
|
||||
|
||||
render () {
|
||||
|
Reference in New Issue
Block a user