frontend: fix autoscroll breaking message loading

This commit is contained in:
hippoz 2022-04-20 17:53:20 +03:00
parent e267ca4fc4
commit addfddd3ac
Signed by: hippoz
GPG key ID: 7C52899193467641

View file

@ -14,7 +14,7 @@
afterUpdate(() => {
if (shouldAutoscroll && scrollTarget) {
scrollTarget.scrollIntoView();
scrollTarget.scrollTo(0, scrollTarget.scrollHeight);
}
});
@ -43,12 +43,11 @@
}
</style>
<div class="messages-container" on:scroll={ onScroll }>
<div class="messages-container" on:scroll={ onScroll } bind:this={ scrollTarget }>
{#each $messages as message (message.id)}
<div>
<b>{ message.author_username }</b>
<span>{ message.content }</span>
</div>
{/each}
<div bind:this={ scrollTarget }></div>
</div>