Skip to content

Commit

Permalink
fix: more robust message handling (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
agazso authored Aug 30, 2023
1 parent 13ce67c commit 51c5b53
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
<p class={`message text-serif ${myMessage ? 'my-message' : ''}`}>
{senderName}
{lastMessage && lastMessage.type === 'user'
? lastMessage.text.substring(0, 50)
? lastMessage.text?.substring(0, 50)
: 'No messages yet'}
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/chat/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<div class="messages-inner">
<!-- Chat bubbles -->
{#each messages as message}
{#if message.type === 'user' && message.text.length > 0}
{#if message.type === 'user' && message.text?.length > 0}
<ChatMessage
myMessage={message.fromAddress === wallet.address ? true : false}
bubble
Expand Down
2 changes: 1 addition & 1 deletion src/routes/group/chat/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
<div class="messages-inner">
<!-- Chat bubbles -->
{#each messages as message, i}
{#if message.type === 'user' && message.text.length > 0}
{#if message.type === 'user' && message.text?.length > 0}
{@const sameSender = messages[i].fromAddress === messages[i - 1]?.fromAddress}
{@const lastMessage =
i + 1 === messages.length ||
Expand Down

1 comment on commit 51c5b53

@vercel
Copy link

@vercel vercel bot commented on 51c5b53 Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.