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: scroll to latest chat message #2763

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/hms-video-store/src/reactive-store/HMSSDKActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ export class HMSSDKActions<T extends HMSGenericTypes = { sessionStore: Record<st
HMSLogger.w('sendMessage', 'Failed to send message', messageInput);
throw Error(`sendMessage Failed - ${JSON.stringify(messageInput)}`);
}
const ignoreMessage = !!messageInput.type && this.ignoredMessageTypes.includes(messageInput.type);
if (ignoreMessage) {
return;
}
const localPeer = this.sdk.getLocalPeer();
const hmsMessage: HMSMessage = {
read: true,
Expand All @@ -427,9 +431,13 @@ export class HMSSDKActions<T extends HMSGenericTypes = { sessionStore: Record<st
senderName: localPeer?.name,
sender: localPeer?.peerId,
senderRole: localPeer?.role?.name,
ignored: !!messageInput.type && this.ignoredMessageTypes.includes(messageInput.type),
ignored: false,
};
this.putMessageInStore(hmsMessage);
// update directly to store without batch
this.setState(store => {
raviteja83 marked this conversation as resolved.
Show resolved Hide resolved
store.messages.byID[hmsMessage.id] = hmsMessage;
store.messages.allIDs.push(hmsMessage.id);
}, 'newMessage');
}

setMessageRead(readStatus: boolean, messageId?: string) {
Expand Down
Loading