Skip to content

Commit

Permalink
fix: load channel at the very end when messageId is undefined (#2706)
Browse files Browse the repository at this point in the history
* fix: load channel at the very end when messageId is undefined

* fix: load channel at the very end when messageId is undefined
  • Loading branch information
khushal87 authored Oct 14, 2024
1 parent 78d83fd commit dbfc01e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions package/src/components/Channel/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,14 @@ const ChannelWithContext = <
) {
loadChannelAtFirstUnreadMessage();
}
// If the messageId is undefined and the last message and the current message id do not match we load the channel at the very bottom.
else if (
channel.state.messages?.[channel.state.messages.length - 1]?.id !==
channel.state.latestMessages?.[channel.state.latestMessages.length - 1]?.id &&
!messageId
) {
await loadChannel();
}
};

initChannel();
Expand Down

0 comments on commit dbfc01e

Please sign in to comment.