Skip to content

Commit b117342

Browse files
authored
perf: do not rerender Channel on poll events (#2959)
* perf: do not rerender Channel on poll events * fix: remove console.log
1 parent c68bc2d commit b117342

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

package/src/components/Channel/Channel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ const ChannelWithContext = <
766766
if (shouldSyncChannel) {
767767
// Ignore user.watching.start and user.watching.stop events
768768
const ignorableEvents = ['user.watching.start', 'user.watching.stop'];
769-
if (ignorableEvents.includes(event.type)) return;
769+
if (ignorableEvents.includes(event.type) || event.type.startsWith('poll.')) return;
770770

771771
// If the event is typing.start or typing.stop, set the typing state
772772
const isTypingEvent = event.type === 'typing.start' || event.type === 'typing.stop';
@@ -869,7 +869,7 @@ const ChannelWithContext = <
869869
listener?.unsubscribe();
870870
};
871871
// eslint-disable-next-line react-hooks/exhaustive-deps
872-
}, [channel.cid, messageId, shouldSyncChannel]);
872+
}, [channelId, messageId, shouldSyncChannel]);
873873

874874
// subscribe to channel.deleted event
875875
useEffect(() => {

0 commit comments

Comments
 (0)