@@ -85,12 +85,10 @@ export class ChannelPreviewComponent implements OnInit, OnDestroy {
85
85
this . channel ! . on ( 'channel.truncated' , this . handleMessageEvent . bind ( this ) )
86
86
) ;
87
87
this . subscriptions . push (
88
- this . channel ! . on ( 'message.read' , ( ) =>
89
- this . ngZone . run ( ( ) => {
90
- this . isUnreadMessageWasCalled = false ;
91
- this . updateUnreadState ( ) ;
92
- } )
93
- )
88
+ this . channel ! . on ( 'message.read' , ( ) => {
89
+ this . isUnreadMessageWasCalled = false ;
90
+ this . updateUnreadState ( ) ;
91
+ } )
94
92
) ;
95
93
this . subscriptions . push (
96
94
this . chatClientService . events$
@@ -102,10 +100,8 @@ export class ChannelPreviewComponent implements OnInit, OnDestroy {
102
100
)
103
101
)
104
102
. subscribe ( ( ) => {
105
- this . ngZone . run ( ( ) => {
106
- this . isUnreadMessageWasCalled = true ;
107
- this . updateUnreadState ( ) ;
108
- } ) ;
103
+ this . isUnreadMessageWasCalled = true ;
104
+ this . updateUnreadState ( ) ;
109
105
} )
110
106
) ;
111
107
}
@@ -137,24 +133,22 @@ export class ChannelPreviewComponent implements OnInit, OnDestroy {
137
133
}
138
134
139
135
private handleMessageEvent ( event : Event ) {
140
- this . ngZone . run ( ( ) => {
141
- if ( this . channel ?. state . latestMessages . length === 0 ) {
142
- this . latestMessage = undefined ;
143
- this . latestMessageStatus = undefined ;
144
- this . latestMessageText = 'streamChat.Nothing yet...' ;
145
- this . latestMessageTime = undefined ;
146
- return ;
147
- }
148
- const latestMessage =
149
- this . channel ?. state . latestMessages [
150
- this . channel ?. state . latestMessages . length - 1
151
- ] ;
152
- if ( ! event . message || latestMessage ?. id !== event . message . id ) {
153
- return ;
154
- }
155
- this . setLatestMessage ( latestMessage ) ;
156
- this . updateUnreadState ( ) ;
157
- } ) ;
136
+ if ( this . channel ?. state . latestMessages . length === 0 ) {
137
+ this . latestMessage = undefined ;
138
+ this . latestMessageStatus = undefined ;
139
+ this . latestMessageText = 'streamChat.Nothing yet...' ;
140
+ this . latestMessageTime = undefined ;
141
+ return ;
142
+ }
143
+ const latestMessage =
144
+ this . channel ?. state . latestMessages [
145
+ this . channel ?. state . latestMessages . length - 1
146
+ ] ;
147
+ if ( ! event . message || latestMessage ?. id !== event . message . id ) {
148
+ return ;
149
+ }
150
+ this . setLatestMessage ( latestMessage ) ;
151
+ this . updateUnreadState ( ) ;
158
152
}
159
153
160
154
private setLatestMessage (
0 commit comments