From ab67ac00b11348fcad504b76d0f9b20f9fe5a7c4 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 8 Sep 2021 12:06:17 +0200 Subject: [PATCH] restore bottom of timeline initially after attach to DOM this will also load more items if the viewport isn't filled --- src/platform/web/ui/session/room/TimelineView.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/platform/web/ui/session/room/TimelineView.ts b/src/platform/web/ui/session/room/TimelineView.ts index 1342d877..71af5f9f 100644 --- a/src/platform/web/ui/session/room/TimelineView.ts +++ b/src/platform/web/ui/session/room/TimelineView.ts @@ -71,6 +71,11 @@ export class TimelineView extends TemplateView { private tilesView?: TilesListView; render(t: TemplateBuilder, vm: TimelineViewModel) { + // assume this view will be mounted in the parent DOM straight away + requestAnimationFrame(() => { + // do initial scroll positioning + this.restoreScrollPosition(); + }); this.tilesView = new TilesListView(vm.tiles, () => this.restoreScrollPosition()); return t.div({className: "Timeline bottom-aligned-scroll", onScroll: () => this.onScroll()}, [ t.view(this.tilesView)