frontend: fix autoscroll breaking message loading
This commit is contained in:
parent
e267ca4fc4
commit
addfddd3ac
1 changed files with 2 additions and 3 deletions
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
afterUpdate(() => {
|
afterUpdate(() => {
|
||||||
if (shouldAutoscroll && scrollTarget) {
|
if (shouldAutoscroll && scrollTarget) {
|
||||||
scrollTarget.scrollIntoView();
|
scrollTarget.scrollTo(0, scrollTarget.scrollHeight);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -43,12 +43,11 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="messages-container" on:scroll={ onScroll }>
|
<div class="messages-container" on:scroll={ onScroll } bind:this={ scrollTarget }>
|
||||||
{#each $messages as message (message.id)}
|
{#each $messages as message (message.id)}
|
||||||
<div>
|
<div>
|
||||||
<b>{ message.author_username }</b>
|
<b>{ message.author_username }</b>
|
||||||
<span>{ message.content }</span>
|
<span>{ message.content }</span>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
<div bind:this={ scrollTarget }></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue