restore bottom of timeline initially after attach to DOM

this will also load more items if the viewport isn't filled
This commit is contained in:
Bruno Windels 2021-09-08 12:06:17 +02:00
parent e89f60bac0
commit ab67ac00b1

View File

@ -71,6 +71,11 @@ export class TimelineView extends TemplateView<TimelineViewModel> {
private tilesView?: TilesListView; private tilesView?: TilesListView;
render(t: TemplateBuilder, vm: TimelineViewModel) { 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()); this.tilesView = new TilesListView(vm.tiles, () => this.restoreScrollPosition());
return t.div({className: "Timeline bottom-aligned-scroll", onScroll: () => this.onScroll()}, [ return t.div({className: "Timeline bottom-aligned-scroll", onScroll: () => this.onScroll()}, [
t.view(this.tilesView) t.view(this.tilesView)