This commit is contained in:
Timothy Jaeryang Baek 2025-09-24 12:37:19 -05:00
parent 23a51f2d01
commit f27ab14bd8

View file

@ -10,6 +10,7 @@
import Messages from './Messages.svelte'; import Messages from './Messages.svelte';
import { onDestroy, onMount, tick, getContext } from 'svelte'; import { onDestroy, onMount, tick, getContext } from 'svelte';
import { toast } from 'svelte-sonner'; import { toast } from 'svelte-sonner';
import Spinner from '../common/Spinner.svelte';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
@ -175,28 +176,34 @@
</div> </div>
<div class=" max-h-full w-full overflow-y-auto" bind:this={messagesContainerElement}> <div class=" max-h-full w-full overflow-y-auto" bind:this={messagesContainerElement}>
<Messages {#if messages !== null}
id={threadId} <Messages
{channel} id={threadId}
{messages} {channel}
{top} {messages}
thread={true} {top}
onLoad={async () => { thread={true}
const newMessages = await getChannelThreadMessages( onLoad={async () => {
localStorage.token, const newMessages = await getChannelThreadMessages(
channel.id, localStorage.token,
threadId, channel.id,
messages.length threadId,
); messages.length
);
messages = [...messages, ...newMessages]; messages = [...messages, ...newMessages];
if (newMessages.length < 50) { if (newMessages.length < 50) {
top = true; top = true;
return; return;
} }
}} }}
/> />
{:else}
<div class="w-full flex justify-center pt-5 pb-10">
<Spinner />
</div>
{/if}
<div class=" pb-[1rem] px-2.5 w-full"> <div class=" pb-[1rem] px-2.5 w-full">
<MessageInput <MessageInput