Skip to content

Trim composable parameters from public API#6365

Merged
gpunto merged 12 commits intov7from
trim-params
Apr 14, 2026
Merged

Trim composable parameters from public API#6365
gpunto merged 12 commits intov7from
trim-params

Conversation

@gpunto
Copy link
Copy Markdown
Contributor

@gpunto gpunto commented Apr 14, 2026

Goal

Trim the public API surface of the Compose SDK by removing composable slot parameters (e.g. itemContent), styling parameters (e.g. color), and forwarded callback parameters from public composables. Customization should go through ChatComponentFactory instead.

Implementation

  • Remove composable slot parameters from ChannelList, MessageList, PinnedMessageList, ThreadList, and MessageContent
  • Remove styling parameters from ChannelListHeader, ChannelHeader, PollCreationHeader
  • Remove forwarded callback parameters from MessageList and ChannelScreen (e.g. onMessageLinkClick, onUserAvatarClick, onUserMentionClick, poll callbacks)
  • Make Messages and Channels composables internal
  • Move reactionSorting from MessageList parameters to ChatUiConfig

Testing

Everything should be working as before

Summary by CodeRabbit

  • Refactor

    • Simplified ChannelList/MessageList/ThreadList: removed many per-item and slot customization points; customization now via theme component factory.
    • Header components now use fixed theme styling (color/shape/elevation removed).
    • Reaction sorting removed from many message APIs — configure via global message list config.
    • ChannelScreen API simplified (fewer visibility flags and callbacks).
  • Chores

    • Some composables made internal/module-private.
  • Docs

    • Samples updated to demonstrate theme-based customization.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 14, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@gpunto gpunto added the pr:breaking-change Breaking change label Apr 14, 2026
@gpunto
Copy link
Copy Markdown
Contributor Author

gpunto commented Apr 14, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 14, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 14, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.82 MB 0.57 MB 🔴
stream-chat-android-ui-components 10.60 MB 10.95 MB 0.36 MB 🟡
stream-chat-android-compose 12.81 MB 12.22 MB -0.59 MB 🚀

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 172a08fd-6bdf-4dbd-8fae-5e418db0ecaa

📥 Commits

Reviewing files that changed from the base of the PR and between 00d8f16 and 3c548eb.

📒 Files selected for processing (2)
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/ChannelScreen.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/threads/ThreadList.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/ChannelScreen.kt

Walkthrough

This PR centralizes UI customization into ChatTheme/ChatComponentFactory, removes many per-call composable slots (channel/item/empty/loading/divider), moves reaction-sorting into MessageListConfig, simplifies header/poll surfaces, and converts several previously public composables to internal.

Changes

Cohort / File(s) Summary
Channel list & samples
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/list/ChannelList.kt, .../Channels.kt, .../ChannelsScreen.kt, stream-chat-android-compose-sample/.../ChannelsActivity.kt, stream-chat-android-docs/.../channels/ChannelList.kt, stream-chat-android-docs/.../channels/ChannelItem.kt
Removed slot/lambda parameters for channel items, dividers, empty/loading states; added onStartChatClick; routing of item rendering now uses ChatTheme.componentFactory and sample/docs updated to use factory-based customization. Channels made internal.
Message list & messages
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageList.kt, .../MessageContainer.kt, .../MessageItem.kt, .../Messages.kt, stream-chat-android-compose-sample/.../MessagesActivity.kt, stream-chat-android-docs/.../messages/MessageList.kt
Removed reactionSorting and many interaction callback parameters and composable slots; introduced messageItemParams factory approach and default theme-provided UI. Messages made internal. Tests and samples updated to remove explicit reactionSorting usage.
Headers & surfaces
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/header/ChannelListHeader.kt, .../messages/header/ChannelHeader.kt, .../attachments/poll/PollCreationHeader.kt, .../cookbook/.../CustomChannelHeader.kt
Removed color, shape, elevation parameters from headers/poll header; surfaces now use fixed theme colors/elevation. Samples/docs updated accordingly.
Polls & message content
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollAnswers.kt, .../components/messages/MessageContent.kt, .../components/messageactions/MessageActions.kt
Removed showAnonymousAvatar from PollAnswersDialog; MessageContent no longer accepts external content slots—renders via ChatTheme.componentFactory; MessageActions stopped forcing a ReactionSorting.
Pinned & thread lists
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/pinned/PinnedMessageList.kt, .../threads/ThreadList.kt
Removed customizable slots (itemContent/itemDivider/empty/loading/loadingMore/banner) from public APIs; implementations now render theme defaults directly and inline item rendering.
Theme & factory params
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt, .../ChatComponentFactoryParams.kt, .../ChatUiConfig.kt
Stopped forwarding reactionSorting through factory default implementations; removed reactionSorting from MessageItem/MessageContainer params; added reactionSorting property to MessageListConfig (default ReactionSortingByFirstReactionAt).
Public API surface
stream-chat-android-compose/api/stream-chat-android-compose.api
Updated exported signatures for many composables/data classes: removed numerous slot/callback parameters, simplified function names/signatures, and removed MessagesKt singleton from public API.
Docs, samples, tests
stream-chat-android-docs/..., stream-chat-android-compose-sample/..., stream-chat-android-ui-guides/..., stream-chat-android-compose/src/test/...
Updated docs, samples, and tests to adopt ChatTheme factory customization, removed explicit reactionSorting and showHeader usages, and adjusted imports/usages accordingly.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

pr:improvement

Suggested reviewers

  • andremion

Poem

🐰 I hopped through themes and factories bright,
Replaced many lambdas with a single light,
Headers slimmed and lists made neat,
Reactions found their config seat,
A tidy hop — components now align, delight! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.40% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Trim composable parameters from public API' directly and clearly summarizes the main change across the entire changeset, which is the removal of composable slot parameters, styling parameters, and callbacks from the public API.
Description check ✅ Passed The PR description includes most required sections (Goal, Implementation, and Testing) with sufficient detail. However, it lacks UI Changes (screenshots/videos), the Contributor Checklist, Reviewer Checklist, and GIF as specified in the template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch trim-params

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
stream-chat-android-compose/api/stream-chat-android-compose.api (1)

895-900: ⚠️ Potential issue | 🟠 Major

Channels(...) is still exporting the old slot-based API.

Line 900 still exposes io/getstream/chat/android/compose/ui/channels/list/ChannelsKt.Channels(...) with four composable lambdas, so callers can bypass the trimmed ChannelList surface and keep depending on the legacy customization path. Please make Channels internal too, or prune this signature the same way as ChannelList, before regenerating the API.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@stream-chat-android-compose/api/stream-chat-android-compose.api` around lines
895 - 900, The exported API still includes the legacy slot-based symbol Channels
(io/getstream/chat/android/compose/ui/channels/list/ChannelsKt.Channels(...)
with four composable lambdas) so callers can bypass ChannelList; update the
source so that Channels is not publicly exposed (make Channels internal or
remove/prune the legacy overload to match the trimmed ChannelList surface), then
regenerate the compiled API so the ChannelsKt.Channels(...) signature is no
longer present in the generated .api file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@stream-chat-android-compose/api/stream-chat-android-compose.api`:
- Around line 895-896: Add a new MIGRATION_TO_V7.md (and update CHANGELOG)
documenting the breaking API changes for ChannelList, ChannelListHeader,
ChannelHeader, MessageList, MessageContent, ChannelScreen, PinnedMessageList,
ThreadList, and PollCreationHeader: describe that slot/callback customization
previously passed into these composables is now provided via
ChatComponentFactory, and that reactionSorting has moved into MessageListConfig;
for each symbol (e.g., ChannelList overloads shown in the diff, MessageList,
MessageContent) include concrete before/after snippets, guidance on wiring
custom components through ChatComponentFactory, examples of creating/updating
MessageListConfig with reactionSorting, and any runtime/behavioral changes
callers must handle.

In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/ChannelScreen.kt`:
- Around line 703-704: Add a KDoc block to the public composable PollDialogs to
document its purpose, parameters and usage: describe that PollDialogs is a
state-driven Composable that observes state from the MessageListViewModel
parameter (explain which data/fields it reads and how it reacts to updates),
state/thread expectations (Compose main thread/UI-only usage and any
coroutine/dispatcher assumptions), lifecycle note (how it should be used in a
parent composable and what triggers re-composition), and any preconditions or
recommended usage patterns for callers of PollDialogs. Reference the function
name PollDialogs and the MessageListViewModel type in the KDoc so callers know
this composable consumes view-model state.

In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/threads/ThreadList.kt`:
- Around line 140-149: The loading and empty branches re-use the caller's
modifier causing duplicate styling because the outer Box already uses
Box(modifier = modifier.padding(padding)); update the calls to
ThreadListLoadingContent and ThreadListEmptyContent to pass a fresh Modifier
(e.g., Modifier) or Modifier.padding(...) instead of the incoming modifier so
they don't re-apply the caller modifier; locate the usages in ThreadList where
ChatTheme.componentFactory.ThreadListLoadingContent(params =
ThreadListLoadingContentParams(modifier = ...)) and
ThreadListEmptyContent(params = ThreadListEmptyContentParams(modifier = ...))
are invoked and replace the passed modifier with Modifier to match the main
thread list branch.

---

Outside diff comments:
In `@stream-chat-android-compose/api/stream-chat-android-compose.api`:
- Around line 895-900: The exported API still includes the legacy slot-based
symbol Channels
(io/getstream/chat/android/compose/ui/channels/list/ChannelsKt.Channels(...)
with four composable lambdas) so callers can bypass ChannelList; update the
source so that Channels is not publicly exposed (make Channels internal or
remove/prune the legacy overload to match the trimmed ChannelList surface), then
regenerate the compiled API so the ChannelsKt.Channels(...) signature is no
longer present in the generated .api file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: aa59f8fd-553d-4991-bf44-cf5689b356ce

📥 Commits

Reviewing files that changed from the base of the PR and between 9c4fcf5 and 00d8f16.

📒 Files selected for processing (30)
  • stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/feature/channel/list/ChannelsActivity.kt
  • stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt
  • stream-chat-android-compose/api/stream-chat-android-compose.api
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/ChannelsScreen.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/header/ChannelListHeader.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/list/ChannelList.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/list/Channels.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messageactions/MessageActions.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/MessageContent.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollAnswers.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/ChannelScreen.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollCreationHeader.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/header/ChannelHeader.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageContainer.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageItem.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageList.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/Messages.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/pinned/PinnedMessageList.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactoryParams.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatUiConfig.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/threads/ThreadList.kt
  • stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/channels/ChannelsTest.kt
  • stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/MessageListTest.kt
  • stream-chat-android-docs/src/main/kotlin/io/getstream/chat/docs/kotlin/compose/channels/ChannelItem.kt
  • stream-chat-android-docs/src/main/kotlin/io/getstream/chat/docs/kotlin/compose/channels/ChannelList.kt
  • stream-chat-android-docs/src/main/kotlin/io/getstream/chat/docs/kotlin/compose/messages/ChannelScreen.kt
  • stream-chat-android-docs/src/main/kotlin/io/getstream/chat/docs/kotlin/compose/messages/MessageList.kt
  • stream-chat-android-docs/src/main/kotlin/io/getstream/chat/docs/kotlin/cookbook/ui/CustomChannelHeader.kt
  • stream-chat-android-ui-guides/src/main/java/io/getstream/chat/android/guides/catalog/compose/customattachments/MessagesActivity.kt
💤 Files with no reviewable changes (7)
  • stream-chat-android-docs/src/main/kotlin/io/getstream/chat/docs/kotlin/compose/messages/ChannelScreen.kt
  • stream-chat-android-ui-guides/src/main/java/io/getstream/chat/android/guides/catalog/compose/customattachments/MessagesActivity.kt
  • stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/MessageListTest.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageItem.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactoryParams.kt
  • stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt

Comment thread stream-chat-android-compose/api/stream-chat-android-compose.api
@gpunto
Copy link
Copy Markdown
Contributor Author

gpunto commented Apr 14, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 14, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gpunto gpunto force-pushed the trim-params branch 3 times, most recently from c30ca6e to da1b0ad Compare April 14, 2026 14:24
@gpunto gpunto marked this pull request as ready for review April 14, 2026 14:35
@gpunto gpunto requested a review from a team as a code owner April 14, 2026 14:36
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
65.9% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@gpunto gpunto enabled auto-merge (squash) April 14, 2026 16:26
@gpunto gpunto merged commit 374d09d into v7 Apr 14, 2026
18 of 20 checks passed
@gpunto gpunto deleted the trim-params branch April 14, 2026 16:41
aleksandar-apostolov added a commit that referenced this pull request Apr 27, 2026
- Fix ChatClientConfig mapping table: correct v6 sources for each param,
  fix userPresence default (true not false), clarify backgroundSyncEnabled
  is removed (not mapped to isAutomaticSyncOnReconnectEnabled)
- Replace hardcoded version numbers with "check Maven Central"
- Add removed lambda parameters for ChannelList, MessageList,
  ChannelScreen, ChannelListHeader, ChannelHeader (PR #6365)
- Document ChatComponentFactory as the replacement for all slot params
  with link to migration docs
- Add cross-reference between §3.4 and §7.2 for changed defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:breaking-change Breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants