Skip to content

refactor: separate thread from channel hoc - #3867

Open
isekovanic wants to merge 5 commits into
perf/message-actionsfrom
refactor/thread-hoc-restructure
Open

isekovanic wants to merge 5 commits into
perf/message-actionsfrom
refactor/thread-hoc-restructure

Conversation

@isekovanic

Copy link
Copy Markdown
Contributor

🎯 Goal

This PR separates the Thread HOC from the Channel one hierarchically. <Thread thread={thread}> now renders next to <Channel> instead of inside it. This removes the if (threadList) ... else ... branching across the SDK and stops opening a thread from running the channel's open sequence, which marked the channel read.

Stacked on perf/message-actions.

🛠 Implementation details

- <Channel channel={thread.channel} thread={thread} threadList>
-   <Thread />
- </Channel>
+ <Thread thread={thread}>
+   <MessageList />
+   <MessageComposer />
+ </Thread>
  • <Channel> and <Thread> share a new internal ChannelShell (providers and config props), and each owns only its own lifecycle.
  • Only <Thread> provides ThreadContext; useThreadContext() no longer throws and returns { thread: undefined } outside a thread.
  • Rows in a thread read the thread's paginator. The last-bubble style comes from the row's neighbours instead of a paginator read.

Breaking changes

  • <Channel> loses thread and threadList.
  • <Thread> renders children, thread is required, and the old list/composer props are removed (parentMessagePreventPress moves to ThreadFooterComponent).
  • The ThreadMessageComposer slot is removed.
  • threadList is removed everywhere. Use useThreadContext().thread.
  • ThreadContextValue is { thread?, allowThreadMessagesInChannel }, and onAlsoSentToChannelHeaderPress moved to MessagesContext.

Fixes

  • Opening a thread, or pressing scroll-to-bottom in one, no longer marks the channel read.
  • The unread separator and last-bubble style in a thread use the thread's own state.

🎨 UI Changes

/

🧪 Testing

/

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

@isekovanic
isekovanic requested review from oliverlaz, santhoshvai and szuperaz and removed request for santhoshvai October 17, 2026 15:41
@Stream-SDK-Bot

Copy link
Copy Markdown
Contributor

SDK Size

title develop branch diff status
js_bundle_size 2036 KB 2019 KB -17229 B 🚀
ai_components_size 130 KB 130 KB 0 B 🟢

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants