{#key chatId}
{#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 bottomPadding}
{/if}
{/key}
{/if}