yield for browser to render before checking content height

This commit is contained in:
Bruno Windels 2020-08-17 17:58:39 +02:00
parent 4044ac56c5
commit 7291cac834

View File

@ -92,9 +92,12 @@ export class TimelineList extends ListView {
super.unmount();
}
loadList() {
async loadList() {
super.loadList();
const root = this.root();
// yield so the browser can render the list
// and we can measure the content below
await Promise.resolve();
const {scrollHeight, clientHeight} = root;
if (scrollHeight > clientHeight) {
root.scrollTop = root.scrollHeight;