GetStream / stream-chat-react

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

Icon and name not set to chat #2451

Closed m-peko closed 2 months ago

m-peko commented 2 months ago

Describe the bug

When creating new channel, channel name and icon are not being saved.

To Reproduce

Here is the code I am using to create new channel:

const channelId = createChannelID(tokenChainID, tokenAddress);
const streamToken = await fetchStreamToken(userAddress);
if (!streamToken) {
  console.error("Failed to fetch stream token");
  return;
}

const newUser = {
  id: userAddress,
  name: userAddress,
  image: `https://getstream.io/random_png/?name=${userAddress}`,
};

const client = StreamChat.getInstance(apiKey);
await client
  .connectUser(newUser, streamToken)
  .then(async () => {
    const channel = client.channel("livestream", channelId, {
      image: iconURL,
      name: name,
    });

    await channel.create();
  })
  .catch((e) => console.error("Failed to connect user", e));

Expected behavior

I would expect channel name and icon being set, but they are not.

Screenshots

image image

Package version

Desktop (please complete the following information):

MartinCupela commented 2 months ago

Hello @m-peko , are you using any demo application here? The default ChannelHeader component loads the image provided via image prop, or determines the image as the other member's user image. I guess here you have only one member that is the creator of the channel + you are not passing the image prop.

m-peko commented 2 months ago

@MartinCupela thanks for reaching out so quickly. You are right. With following having set:

<ChannelHeader title={name} image={iconURL} />

everything works fine. I am now confused because previously this was working, i.e. I didn't have these two set in ChannelHeader but still I had chat image and title.