feat: add channel state reactive stores#1699
Open
MartinCupela wants to merge 3 commits intomasterfrom
Open
Conversation
Contributor
|
Size Change: +5.84 kB (+1.6%) Total Size: 370 kB
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds reactive display state to channels and threads so UIs across different SDKs can subscribe to display name (and image) updates instead of maintain separate potentially diverging implementations.
It also allows creating a Thread with only a channel and parent message (no threadData) and standardizes thread display name to custom → channel display name.
Channel
1. ChannelState – reactive display store
2. ChannelState - convert static properties into backwards compatible reactive stores
As we are adding reactive display store, we have opportunity to add stores for other
ChannelStateproperties.membersStore—{ members: Record<string, ChannelMemberResponse>; memberCount: number }Member list and count. Updated when members are hydrated or member events are applied.
readStore—{ read: ChannelReadStatus }Per-user read state (last read, unread counts, etc.). Updated from read events and channel sync.
typingStore—{ typing: Record<string, Event> }Active typing indicators by user. Updated from typing.start / typing.stop (and similar) events.
watcherStore—{ watchers: Record<string, UserResponse>; watcherCount: number }Current watchers and count. Updated when watcher presence events are applied.
ownCapabilitiesStore—{ ownCapabilities: string[] }Current user’s capabilities in this channel. Updated when membership/capabilities are synced from channel data or events. Sync over WS is current not supported from the server-side, but may be in the future.
mutedUsersStore—{ mutedUsers: UserResponse[] }Users muted in the channel. Updated when mute state is synced or changed.
Thread
1. Constructor with optional data
2. New
displayNameproperty in ThreadStatedisplayNameon ThreadState: Thread state includes a reactivedisplayNamederived from: (1) custom display name generator, (2) channel display name.titleproperty onThreadResponsetype and so it may be desirable in the future customize the logic to include this property to derive the display name. Also name could be derived from participants names, etc.