Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get correct lastMessage and latestMessagePreview from channel state #2535

Merged

Conversation

MartinCupela
Copy link
Contributor

🎯 Goal

Fix bug of not syncing lastMessage and latestMessage. Meanwhile the latestMessage was correctly taken from the channel state, the lastMessage was set as any message coming with message.new, message.updated and message.deleted. Moreover, message.undeleted and channel.truncate were not taken into consideration when setting lastMessage. Now both are set from the channel.state.

Another fix is that latestMessage was derived from channel.state.messages what is a getter that returns the currently viewed message set in the message list, but not the latest message set. This had to be changed to channel.state.latestMessages.

I have deprecated latestMessage in favor of latestMessagePreview because for integrators (and for me) it was unclear how does it differ from lastMessage.

Finally I have added possibility to customize the possibility of generating latest message preview through new prop getLatestMessagePreview to ChannelList and ChannelPreview.

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.46%. Comparing base (791f1fa) to head (251c053).
Report is 3 commits behind head on release-v11.

Additional details and impacted files
@@              Coverage Diff              @@
##           release-v11    #2535    +/-   ##
=============================================
  Coverage        85.45%   85.46%            
=============================================
  Files              395      395            
  Lines             9136     9141     +5     
  Branches          2359     2493   +134     
=============================================
+ Hits              7807     7812     +5     
+ Misses            1125      928   -197     
- Partials           204      401   +197     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MartinCupela MartinCupela merged commit ba6b1a3 into release-v11 Oct 15, 2024
8 checks passed
@MartinCupela MartinCupela deleted the fix/channel-preview-last-message-from-channel-state branch October 15, 2024 11:09
github-actions bot pushed a commit that referenced this pull request Oct 15, 2024
## [11.24.1](v11.24.0...v11.24.1) (2024-10-15)

### Bug Fixes

* get correct lastMessage and latestMessagePreview from channel state ([#2535](#2535)) ([ba6b1a3](ba6b1a3))
@stream-ci-bot
Copy link
Collaborator

🎉 This PR is included in version 11.24.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

github-actions bot pushed a commit that referenced this pull request Oct 15, 2024
## [12.2.1](v12.2.0...v12.2.1) (2024-10-15)

### Bug Fixes

* get correct lastMessage and latestMessagePreview from channel state ([#2535](#2535)) ([9dcf4f3](9dcf4f3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants