Update +page.svelte (#1568)

Changed `messages` to `messageFeed` since `messages` variable doesn't exist in earlier codes.
This commit is contained in:
Godfrey Laswai
2023-05-25 18:45:45 +03:00
committed by GitHub
parent 05323033b3
commit cc2a472552

View File

@@ -565,7 +565,7 @@ function scrollChatBottom(behavior?: ScrollBehavior): void {
code={` code={`
function addMessage(): void { function addMessage(): void {
const newMessage = { const newMessage = {
id: messages.length, id: messageFeed.length,
host: true, host: true,
avatar: 48, avatar: 48,
name: 'Jane', name: 'Jane',
@@ -574,7 +574,7 @@ function addMessage(): void {
color: 'variant-soft-primary' color: 'variant-soft-primary'
}; };
// Append the new message to the message feed // Append the new message to the message feed
messages = [...messages, newMessage]; messageFeed = [...messageFeed, newMessage];
// Clear the textarea message // Clear the textarea message
currentMessage = ''; currentMessage = '';
// Smoothly scroll to the bottom of the feed // Smoothly scroll to the bottom of the feed