mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-12 15:01:38 +03:00
chat: window-based overscan, bigger pages
This commit is contained in:
parent
2b95b308b8
commit
d27a26ec31
@ -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');
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user