Skip to content

Commit 3e8123c

Browse files
fix: issue with app crash after sending message offline and reopening the app in offline mode
1 parent 3323320 commit 3e8123c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

package/src/components/Channel/Channel.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,13 @@ const ChannelWithContext = <
11921192
text,
11931193
...extraFields
11941194
}: Partial<StreamMessage<StreamChatGenerics>>) => {
1195+
// Exclude following properties from message.user within message preview,
1196+
// since they could be long arrays and have no meaning as sender of message.
1197+
// Storing such large value within user's table may cause sqlite queries to crash.
1198+
// @ts-ignore
1199+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1200+
const { channel_mutes, devices, mutes, ...messageUser } = client.user;
1201+
11951202
const preview = {
11961203
__html: text,
11971204
attachments,
@@ -1209,7 +1216,7 @@ const ChannelWithContext = <
12091216
type: 'regular',
12101217
user: {
12111218
id: client.userID,
1212-
...client.user,
1219+
...messageUser,
12131220
},
12141221
...extraFields,
12151222
} as unknown as MessageResponse<StreamChatGenerics>;

0 commit comments

Comments
 (0)