Skip to content

Commit 67ea2f8

Browse files
committed
fix: issues with handleSyncDb events
1 parent 1dbded9 commit 67ea2f8

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

package/src/components/Chat/hooks/handleEventToSyncDB.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,7 @@ export const handleEventToSyncDB = async <
7777
return createQueries(flush);
7878
};
7979

80-
if (type === 'message.read') {
81-
const cid = event.cid;
82-
const user = event.user;
83-
if (user?.id && cid) {
84-
return await queriesWithChannelGuard((flushOverride) =>
85-
upsertReads({
86-
cid,
87-
flush: flushOverride,
88-
reads: [
89-
{
90-
last_read: event.received_at as string,
91-
unread_messages: 0,
92-
user,
93-
},
94-
],
95-
}),
96-
);
97-
}
98-
}
99-
100-
if (type === 'notification.mark_read') {
80+
if (type === 'message.read' || type === 'notification.mark_read') {
10181
const cid = event.cid;
10282
const user = event.user;
10383
if (user?.id && cid) {

package/src/contexts/channelContext/ChannelContext.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ export type ChannelContextValue<
6262
hideStickyDateHeader: boolean;
6363
/**
6464
* Loads channel around a specific message
65+
* @param limit - The number of messages to load around the message
66+
* @param messageId - The message around which to load messages
67+
* @param setTargetedMessage - Callback to set the targeted message
6568
*/
6669
loadChannelAroundMessage: ({
6770
limit,
@@ -75,6 +78,9 @@ export type ChannelContextValue<
7578

7679
/**
7780
* Loads channel at first unread message.
81+
* @param channelUnreadState - The unread state of the channel
82+
* @param limit - The number of messages to load around the first unread message
83+
* @param setChannelUnreadState - Callback to set the channel unread state
7884
*/
7985
loadChannelAtFirstUnreadMessage: ({
8086
channelUnreadState,

0 commit comments

Comments
 (0)