GetStream / stream-chat-react

React Chat SDK ➜ Stream Chat 💬
https://getstream.io/chat/sdk/react/
Other
700 stars 273 forks source link

Where is channels in the chatContext? #176

Closed leogoesger closed 4 years ago

leogoesger commented 4 years ago

In the doc it says channels are in the chatContext, but it seems like it isn't supported it.

channel, client, and setActiveChannel are the only objects.

vishalnarkhede commented 4 years ago

Hey @leogoesger , thanks for bringing it up. It looks like a mistake in docs, we will update the docs.

leogoesger commented 4 years ago

@vishalnarkhede I could raise other issues, but EmptyStateIndicator is missing in ChannelList's prop types.

And if may, what is the strategy to add user to a chat when the user has not been created?

Use case: We are migrating from Chatkit, so lots of current users have never called setUser yet. We need a way for us to initiate the convo with those un-initialized users, and does the initialization at the same time.

In Chatkit, we did it on the server level, we send the error message to the server and have it create those users, and then create the channel.

Is that still the correct approach here? Or there is something built in?

thesyncim commented 4 years ago

@leogoesger, yes, users need to be created before added to a channel.

(I'm aware that pusher is working on an export tool that will make this process easier, but it's not ready yet)

for now, you can either use server-side auth or alternatively you could generate an import file.

leogoesger commented 4 years ago

@thesyncim what doe server side auth mean? creating the user on server side once error? or using the updateUsers methods creating all the users beforehand?

tbarbugli commented 4 years ago

@leogoesger yes, you can use updateUsers to sync users in bulk from your backend (apologies for the misnomer, it actually does an upsert)

vishalnarkhede commented 4 years ago

Hey @leogoesger , thanks for bringing it up. It looks like a mistake in docs, we will update the docs.

@leogoesger we have updated the docs. Closing this for now ... If you have any more followup questions, please feel free to reopen.