You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// update the client.state with any changes to usersif(event.user&&(event.type==='user.presence.changed'||event.type==='user.updated')){if(event.user?.id===this.userID){this.user=this.user&&{ ...this.user, ...event.user};// <-- the problem is here// Updating only available properties in _user object.Object.keys(event.user).forEach(function(key){if(client._user&&keyinclient._user){// @ts-expect-errorclient._user[key]=event.user[key];}});}client.state.updateUser(event.user);client._updateUserReferences(event.user);}
To be clear:
If a property is present on this.user
and a subsequent update on the backend dispatches a 'user.updated' event with the updated representation of the user in which the property is absent
the object spread {...this.user, will cause the deleted property to be retained despite it being removed in the serialized user on the event object
gz#10673
The text was updated successfully, but these errors were encountered:
The following line means that if a property is removed from a user on the server side, it will never be removed from the client's copy of the user:
https://github.com/GetStream/stream-chat-js/blob/master/src/client.ts#L1199
To be clear:
this.user
'user.updated'
event with the updated representation of the user in which the property is absent{...this.user,
will cause the deleted property to be retained despite it being removed in the serialized user on the event objectgz#10673
The text was updated successfully, but these errors were encountered: