Getting a "Invalid 'url' is undefined" error when using ChannelList

I’m currently using "sendbird-uikit": "^2.3.2-alpha" in my project, and I am using ChannelList, as such:

<ChannelList onChannelSelect={(channel) => {
                    this.props.selectedChannel(channel);
                }}
            />

What’s happening is that when I create one group channel and then leave that channel, my React app immediately crashes saying that ChannelList is looking for url but it is undefined.

I’m seeing that the error comes from this area, SendBird-UIKIT-JavaScript/ChannelList.js at master · sendbird/SendBird-UIKIT-JavaScript · GitHub.

For more information, this is the error:

TypeError: Cannot read property 'url' of undefined

The stack trace is as such (in reducer.js):

  107 | const filteredChannels = state.allChannels.filter((c) => c.url !== channel.url);
  108 | return {
  109 |   ...state,
> 110 |   currentChannel: (isMe && (channel.url === state.currentChannel))
| 111 |     ? filteredChannels[0].url
  112 |     : state.currentChannel,
  113 |   allChannels: filteredChannels,

Also,

ChannelList
src/smart-components/ChannelList/index.jsx:69
  66 | const sdkError = sdkStore.error;
  67 | const sdkIntialized = sdkStore.initialized;
  68 | 
> 69 | const [channelListStore, channelListDispatcher] = useReducer(
| 70 |   channelListReducers,
  71 |   channelListInitialState,
  72 | );

Is this a bug, or something on my side?

I am also facing the same issue

I also have the same issue.

In my case that happens when i leave the last channel that i have on the channel list.

“version”: “2.4.2”

Hi @henrique_de_oliveira,

Could you share with me a video of the issue occurring so I can better understand what you’re experiencing?

Processing: Screen Recording 2021-11-12 at 16.25.34.mov…

Thank you for that video. Let me take a look into this and see if I can uncover what is going on.

1 Like