chat: window-based overscan, bigger pages

This commit is contained in:
Liam Fitzgerald 2020-12-11 12:57:09 +10:00
parent 2b95b308b8
commit d27a26ec31
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
2 changed files with 6 additions and 4 deletions

View File

@ -199,14 +199,14 @@ export default class ChatWindow extends Component<ChatWindowProps, ChatWindowSta
const currSize = graph.size;
if(newer && !this.loadedNewest) {
const [index] = graph.peekLargest()!;
await api.graph.getYoungerSiblings(ship,name, 5, `/${index.toString()}`)
await api.graph.getYoungerSiblings(ship,name, 100, `/${index.toString()}`)
if(currSize === graph.size) {
console.log('loaded all newest');
this.loadedNewest = true;
}
} else if(!newer && !this.loadedOldest) {
const [index] = graph.peekSmallest()!;
await api.graph.getOlderSiblings(ship,name, 5, `/${index.toString()}`)
await api.graph.getOlderSiblings(ship,name, 100, `/${index.toString()}`)
this.calculateUnreadIndex();
if(currSize === graph.size) {
console.log('loaded all oldest');

View File

@ -143,13 +143,15 @@ export default class VirtualScroller extends Component<VirtualScrollerProps, Vir
const { data, size: totalSize, onCalculateVisibleItems } = this.props;
console.log(windowHeight);
const overscan = Math.max(windowHeight / 2, 200);
[...data].forEach(([index, datum]) => {
const height = this.heightOf(index);
if (startgap < (scrollTop - height) && !startGapFilled) {
if (startgap < (scrollTop - overscan) && !startGapFilled) {
startBuffer.set(index, datum);
startgap += height;
} else if (heightShown < (windowHeight + height)) {
} else if (heightShown < (windowHeight + overscan)) {
startGapFilled = true;
visibleItems.set(index, datum);
heightShown += height;