File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
package/src/components/Chat/hooks Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -130,15 +130,17 @@ export const handleEventToSyncDB = async <
130130 } ) ;
131131 if ( cid && client . user && client . user . id !== user ?. id ) {
132132 const userId = client . user . id ;
133- const ownReads = client . activeChannels [ cid ] ?. state . read [ userId ] ;
133+ const channel = client . activeChannels [ cid ] ;
134+ const ownReads = channel ?. state . read [ userId ] ;
135+ const unreadCount = channel ?. state . unreadCount ;
134136 const upsertReadsQueries = await upsertReads ( {
135137 cid,
136138 flush : flushOverride ,
137139 reads : [
138140 {
139141 last_read : ownReads . last_read . toString ( ) as string ,
140142 last_read_message_id : ownReads . last_read_message_id ,
141- unread_messages : ownReads ?. unread_messages ,
143+ unread_messages : unreadCount ,
142144 user : client . user ,
143145 } ,
144146 ] ,
You can’t perform that action at this time.
0 commit comments