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