VirtualScroller: lock scroll less aggressively

Prevents incorrect scroll adjustment
This commit is contained in:
Liam Fitzgerald 2021-04-24 12:22:08 +10:00
parent 6a1f0e2ac9
commit 2e7b1cd41d
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -361,10 +361,6 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
// bail if we're going to adjust scroll anyway // bail if we're going to adjust scroll anyway
return; return;
} }
if(this.initScroll) {
clearTimeout(this.initScroll);
this.initScroll = null;
}
if(this.saveDepth > 0) { if(this.saveDepth > 0) {
log('bail', 'deep scroll queue'); log('bail', 'deep scroll queue');
return; return;
@ -376,17 +372,15 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
const startOffset = this.startOffset(); const startOffset = this.startOffset();
if (scrollTop < ZONE_SIZE) { if (scrollTop < ZONE_SIZE) {
log('scroll', `Entered start zone ${scrollTop}`); log('scroll', `Entered start zone ${scrollTop}`);
if (startOffset === 0 && onStartReached) { if (startOffset === 0) {
onStartReached(); onStartReached && onStartReached();
this.scrollLocked = true;
} }
const newOffset = Math.max(0, startOffset - this.pageDelta); const newOffset = Math.max(0, startOffset - this.pageDelta);
if(newOffset < 10) { if(newOffset < 10) {
this.loadBottom(); this.loadBottom();
} }
if(newOffset === 0) {
this.scrollLocked = true;
}
if(newOffset !== startOffset) { if(newOffset !== startOffset) {
this.updateVisible(newOffset); this.updateVisible(newOffset);
} }