Skip to content

Commit

Permalink
Merge pull request #186 from GetStream/vishal/bug-fixes
Browse files Browse the repository at this point in the history
Fixing channel.updated and channel.deleted handlers
  • Loading branch information
vishalnarkhede authored Mar 26, 2020
2 parents 36f8fd0 + 6c28961 commit f5d5f0c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/ChannelList.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ class ChannelList extends PureComponent {
const channelIndex = channels.findIndex(
(channel) => channel.cid === e.channel.cid,
);

if (channelIndex < 0) return;

channels[channelIndex].data = Immutable(e.channel);

this.setState({
Expand Down Expand Up @@ -404,6 +407,9 @@ class ChannelList extends PureComponent {
const channelIndex = channels.findIndex(
(channel) => channel.cid === e.channel.cid,
);

if (channelIndex < 0) return;

// Remove the deleted channel from the list.s
channels.splice(channelIndex, 1);
this.setState({
Expand Down

0 comments on commit f5d5f0c

Please sign in to comment.