@@ -311,14 +311,11 @@ export class ChannelService<
311311 beforeUpdateMessage ?: (
312312 message : StreamMessage < T >
313313 ) => StreamMessage < T > | Promise < StreamMessage < T > > ;
314- /**
315- * @internal
316- */
317- static readonly MAX_MESSAGE_COUNT_IN_MESSAGE_LIST = 250 ;
318314 /**
319315 * @internal
320316 */
321317 static readonly MAX_MESSAGE_REACTIONS_TO_FETCH = 1200 ;
318+ messagePageSize = 25 ;
322319 private channelsSubject = new BehaviorSubject < Channel < T > [ ] | undefined > (
323320 undefined
324321 ) ;
@@ -347,7 +344,6 @@ export class ChannelService<
347344 private latestMessageDateByUserByChannelsSubject = new BehaviorSubject < {
348345 [ key : string ] : Date ;
349346 } > ( { } ) ;
350- private messagePageSize = 25 ;
351347 private readonly attachmentMaxSizeFallbackInMB = 100 ;
352348 private messageToQuoteSubject = new BehaviorSubject <
353349 StreamMessage < T > | undefined
@@ -518,28 +514,6 @@ export class ChannelService<
518514 . pipe ( shareReplay ( 1 ) ) ;
519515 }
520516
521- /**
522- * internal
523- */
524- removeOldMessageFromMessageList ( ) {
525- const channel = this . activeChannelSubject . getValue ( ) ;
526- const channelMessages = channel ?. state . latestMessages ;
527- const targetLength = Math . ceil (
528- ChannelService . MAX_MESSAGE_COUNT_IN_MESSAGE_LIST / 2
529- ) ;
530- if (
531- ! channel ||
532- ! channelMessages ||
533- channelMessages !== channel ?. state . latestMessages ||
534- channelMessages . length <= targetLength
535- ) {
536- return ;
537- }
538- const messages = channelMessages ;
539- messages . splice ( 0 , messages . length - targetLength ) ;
540- this . activeChannelMessagesSubject . next ( messages ) ;
541- }
542-
543517 /**
544518 * If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
545519 */
@@ -1646,6 +1620,13 @@ export class ChannelService<
16461620 return this . activeChannelMessagesSubject . getValue ( ) || [ ] ;
16471621 }
16481622
1623+ /**
1624+ * The current thread replies
1625+ */
1626+ get activeChannelThreadReplies ( ) {
1627+ return this . activeThreadMessagesSubject . getValue ( ) || [ ] ;
1628+ }
1629+
16491630 /**
16501631 * Get the last 1200 reactions of a message in the current active channel. If you need to fetch more reactions please use the [following endpoint](https://getstream.io/chat/docs/javascript/send_reaction/?language=javascript#paginating-reactions).
16511632 * @param messageId
@@ -1750,7 +1731,7 @@ export class ChannelService<
17501731 const messageIndex = messages . findIndex (
17511732 ( m ) => m . id === event ?. message ?. id
17521733 ) ;
1753- if ( messageIndex !== - 1 ) {
1734+ if ( messageIndex !== - 1 || event . type === 'message.deleted' ) {
17541735 isThreadReply
17551736 ? this . activeThreadMessagesSubject . next ( [ ...messages ] )
17561737 : this . activeChannelMessagesSubject . next ( [ ...messages ] ) ;
0 commit comments