File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
package/src/components/Channel Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -766,9 +766,17 @@ const ChannelWithContext = <
766766
767767 const handleEvent : EventHandler < StreamChatGenerics > = ( event ) => {
768768 if ( shouldSyncChannel ) {
769- // Ignore user.watching.start and user.watching.stop events
770- const ignorableEvents = [ 'user.watching.start' , 'user.watching.stop' ] ;
771- if ( ignorableEvents . includes ( event . type ) || event . type . startsWith ( 'poll.' ) ) return ;
769+ /**
770+ * Ignore user.watching.start and user.watching.stop as we should not copy the entire state when
771+ * they occur. Also ignore all poll related events since they're being handled in their own
772+ * reactive state and have no business having an effect on the Channel component.
773+ */
774+ if (
775+ event . type . startsWith ( 'poll.' ) ||
776+ event . type === 'user.watching.start' ||
777+ event . type === 'user.watching.stop'
778+ )
779+ return ;
772780
773781 // If the event is typing.start or typing.stop, set the typing state
774782 const isTypingEvent = event . type === 'typing.start' || event . type === 'typing.stop' ;
@@ -871,7 +879,7 @@ const ChannelWithContext = <
871879 listener ?. unsubscribe ( ) ;
872880 } ;
873881 // eslint-disable-next-line react-hooks/exhaustive-deps
874- } , [ channelId , messageId , shouldSyncChannel ] ) ;
882+ } , [ channel . cid , messageId , shouldSyncChannel ] ) ;
875883
876884 // subscribe to channel.deleted event
877885 useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments