Repository navigation
feat: UI sdk state cleanup in favor of llc - #3848
Merged
Merged
Conversation
…nup-in-favor-of-llc
Contributor
SDK Size
|
oliverlaz
approved these changes
Oct 9, 2026
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.
🎯 Goal
Linear ticket: https://linear.app/stream/issue/REACT-1218/remove-ui-state-duplicated-from-the-stream-chat-in-scrn
stream-chatv10 publishes channel, message, thread and composer state through reactive stores (channel.state, the message and channel paginators,client.threads,messageComposer). The SDK still kept its own copies of a lot of that state from the v9 model: context fields mirroring paginator state, event listeners rebuilding what the client already publishes, memo keys built from stringified state, and hand-written send/edit logic duplicating the composer.This PR removes those copies and reads the
stream-chatstate directly. The UI is unchanged apart from the bug fixes listed below. It is a breaking change for integrators who used the removed context fields, props and exports; every one is listed with its replacement inai-docs/ai-migration-v9-to-v10.md.It is also part 1/2 of a larger cleanup pass in SCRN, which will come in a separate PR.
🛠 Implementation details
The work is split into one commit per area.
1. Dead code (
8d149acd5)useSelectedChannelState,reduceMessagesToString,findInMessagesById,findInMessagesByDate,getLastReceivedMessage,DebugContext, the unusedChannelListhook utils, and offline-store functions nothing called.isChannelActive,scrollToFirstUnreadThreshold,MessagesContext.quotedMessage,<Channel isOnline>and others).useIsOnlineis renamed touseConnectionLifecycle, since it returns nothing in v10.useMutedChannels()no longer takes an argument.OfflineStoreApisusesuserIdinstead ofcurrentUserId.2. Message lists (
ce99291d3)MessageListandMessageFlashListpage the paginator they render (the channel's, or the thread's in a thread list) and track their own loading flags. TheloadMore/loadMoreRecent/hasMoreprops are gone.MessageList/hooks.MessageListto the bottom.3.
ChatContext(a04468e10)ChatContextholds onlyclient,getAppSettingsandisMessageAIGenerated.channel,setActiveChannel,appSettings,mutedUsersandenableOfflineSupportare removed.getAppSettings()followsstream-chat-react: it fetches once per user, falls back to the offline database, and does not cache a failure.<Chat>follows the connected user reactively. It used to readclient.userIDduring render, so the offline database could miss a user that connected after mount.4.
<Channel>(0a75ced25)frozenis read reactively, sodisabledupdates on freeze and unfreeze.cid.<Channel>no longer re-renders on channel updates that leave its capabilities unchanged, andoverrideOwnCapabilitiesmerges correctly.typing.stopis sent on background only if the user was typing.<Channel>keeps rendering a deleted channel, as instream-chat-react. The app decides what to show from the channel'spendingDisposalstate. The SampleApp does this inuseLeaveGoneChannel.5. Composer (
5a7abceaa)messageComposer.send()/update(). The SDK's own send and edit wrappers are removed.<Channel preSendMessageRequest>is replaced by thesendMessageRequestrequest handler.client.notifications, mapped to the same toast copy as before.MessageComposerProvider. EachuseMessageComposer()call used to create its own subscriptions.SendMessageDisallowedIndicator, the commands button and the commands sheet follow capabilities and config that arrive after mount.patchMessageTextCommand) is removed, since the backend now resolves the target from the mentioned users.6. Channel list (
5cf121467)ChannelsContextholds the list's configuration and itsChannelPaginator. The query state (channels,loadingChannels,refreshing, ...) goes toChannelListViewas props. The memo key built from every channel's name, unread count and member presence is gone.FlatListsetsstrictMode. Channel rows now re-render only when their own channel changes, instead of all of them on every list update.onSelect,getChannelActionItems,maxUnreadCount, ...) take effect when changed at runtime.disconnectUser()once a user connects again. It used to stay on its skeleton.7. Thread list (
71a373a53)thread.messagePaginator.aggregateState, asstream-chat-reactdoes. It used to take the last reply of the loaded page, which is an older reply once the thread has been scrolled back.🎨 UI Changes
/
🧪 Testing
/
☑️ Checklist
V10branchai-docs/ai-migration-v9-to-v10.md, Part P)