stream-chat-js icon indicating copy to clipboard operation
stream-chat-js copied to clipboard

addMembers does not include any user properties

Open StronkMan opened this issue 4 years ago • 4 comments

Describe the bug In demo, addMembers does not include the user properties but the id

Dev environment info (please complete/provide the following information):

  • Package version (stream-chat-react-native/stream-chat-expo): 3.6.0
  • react-native or expo version: 0.64.2
  • Device/Emulator (android/ios) and OS version: iphonesimulator 14.5

To Reproduce Steps to reproduce the behavior:

  1. Go to any channel with appropriate access
  2. Go to channel info screen
  3. Add any new member
  4. Observe the new member entry is a blank row
  5. In channel.state.member, all other additional properties are missing.

Expected behavior User data should be queried and included in channel.state.member list. Either addMember should accept User object with additional properties or handle the query of the user and populate the properties by id

gz#13722

StronkMan avatar Jun 26 '21 04:06 StronkMan

Has this issue been looked into? @vishalnarkhede This also happens when you update the channel server-side.

e.g. Server: Receive webhook events after channel.created and promote the creator of the channel to a moderator. Client: Channel receives ws push, then the updated user object within member is reduced to id only without other properties(name, image,...custom properties).

StronkMan avatar Jul 19 '21 02:07 StronkMan

Hi,

Thanks for reaching out. We haven't been able to reproduce this issue unfortunately. In the channel.state.members array, each member object contains the banned status, channel_role, created_at, few other fields and the user object attached to the member. This user object should contain all the properties related to the user. This is the way the API is currently implemented, are you having a different behaviour?

Best,

SeniYG avatar Jul 20 '21 14:07 SeniYG

Hi,

Since we are not directly integrating with the js-lib but the rn-components, we can provide you a simple demo here, it was freshly cloned and using the latest packages as of today. Please let me know if more details need to be provided.

https://user-images.githubusercontent.com/27749440/126355734-b126769d-f2ac-4716-944f-f13ae754fc4f.mp4

In: https://github.com/GetStream/stream-chat-js/blob/master/src/channel.ts

As the event may not contain the full properties of a user, whenever there's an update on the member, the properties in the user will be replaced with the incomplete one from the event.

      case 'member.added':
      case 'member.updated':
        if (event.member?.user_id) {
          channelState.members[event.member.user_id] = event.member;
        }

StronkMan avatar Jul 20 '21 15:07 StronkMan

Hi,

Thanks for reaching out. We haven't been able to reproduce this issue unfortunately. In the channel.state.members array, each member object contains the banned status, channel_role, created_at, few other fields and the user object attached to the member. This user object should contain all the properties related to the user. This is the way the API is currently implemented, are you having a different behaviour?

Best,

@SeniYG Updated my example above. Hopefully, it can help you resolve this issue swiftly.

StronkMan avatar Jul 24 '21 22:07 StronkMan

@StronkMan thanks for reaching out, this issue slipped through. Is this issue still relevant with the latest versions of our RN SDK and Chat JS client?

vanGalilea avatar Aug 18 '22 13:08 vanGalilea

@StronkMan I'll be closing this issue due to inactivity Please don't hesitate to contact us in the future if this issue or any questions arise.

vanGalilea avatar Oct 14 '22 06:10 vanGalilea