Skip to content

Commit 1876561

Browse files
committed
fix: add few optimizations
1 parent 4055021 commit 1876561

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

package/src/components/MessageList/MessageFlashList.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ const flatListViewabilityConfig: ViewabilityConfig = {
6161
};
6262

6363
const hasReadLastMessage = (channel: Channel, userId: string) => {
64-
const latestMessageIdInChannel = channel.state.latestMessages.slice(-1)[0]?.id;
64+
const latestMessageIdInChannel =
65+
channel.state.latestMessages[channel.state.latestMessages.length - 1]?.id;
6566
const lastReadMessageIdServer = channel.state.read[userId]?.last_read_message_id;
6667
return latestMessageIdInChannel === lastReadMessageIdServer;
6768
};
@@ -214,11 +215,11 @@ const getItemTypeInternal = (message: LocalMessage) => {
214215

215216
if (message.text) {
216217
const text = message.text;
217-
if (text.length <= 20) {
218+
if (text.length <= 50) {
218219
return 'short-message-with-text';
219220
}
220221

221-
if (text.length <= 100) {
222+
if (text.length <= 200) {
222223
return 'medium-message-with-text';
223224
}
224225

0 commit comments

Comments
 (0)