-
Notifications
You must be signed in to change notification settings - Fork 43
Chat add message.with event example #2477
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
base: main
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
99c2463
to
772270e
Compare
content/chat/rooms/messages.textile
Outdated
|
||
Update and Delete events provide the full message payload, so may be used to replace the entire earlier version of the message. | ||
|
||
h3(#keep-messages-updated). Keep messages updated with @with@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we wrap this entire section in a blang
until we have Kotlin/Swift equivalents?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't seem to get this to work correctly.
content/chat/rooms/messages.textile
Outdated
|
||
Update and Delete events provide the full message payload, so may be used to replace the entire earlier version of the message. | ||
|
||
h3(#keep-messages-updated). Keep messages updated with @with@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment this is in the "ordering" section - feels like it should be part of message update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a h2.
content/chat/rooms/messages.textile
Outdated
import { MessageEvents, Message } from '@ably/chat'; | ||
let myMessageList: Message[]; | ||
|
||
const {unsubscribe} = room.messages.subscribe((event) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const {unsubscribe} = room.messages.subscribe((event) => { | |
const { unsubscribe } = room.messages.subscribe((event) => { |
content/chat/rooms/messages.textile
Outdated
break; | ||
case MessageEvents.Updated: | ||
case MessageEvents.Deleted: | ||
const idx = myMessageList.findIndex((msg) => msg.serial === event.message.serial); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const idx = myMessageList.findIndex((msg) => msg.serial === event.message.serial); | |
const idx = myMessageList.findIndex((msg) => event.message.isNewerVersionOf(msg)); |
content/chat/rooms/messages.textile
Outdated
case MessageEvents.Deleted: | ||
setMyMessageList((prev) => { | ||
// find existing message to apply update or delete to | ||
const existing = prev.list.find(event.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const existing = prev.list.find(event.message); | |
const existing = prev.list.findIndex((msg) => event.message.isNewerVersionOf(msg)); |
Made this a draft, will pick it up after either Swift and Kotlin add the |
772270e
to
0e22967
Compare
7e218a6
to
bc070bb
Compare
Description
https://ably.atlassian.net/browse/CHA-871
Checklist