{#each messages as message, messageIdx (message.id)}
{
if (autoScroll) {
const element = document.getElementById('messages-container');
autoScroll =
element.scrollHeight - element.scrollTop <= element.clientHeight + 50;
setTimeout(() => {
scrollToBottom();
}, 100);
}
}}
/>
{/each}
{#if messages.at(-1).parentId !== null}
{
console.log('visible');
if (!messagesLoading) {
loadMoreMessages();
}
}}
>
{/if}