Skip to content

Expose the channel state from the Compose MessageListViewModel - #6734

Merged
gpunto merged 2 commits into
v6from
feat/v6-compose-message-list-channel-state
Sep 28, 2026
Merged

gpunto merged 2 commits into
v6from
feat/v6-compose-message-list-channel-state

Conversation

@gpunto

@gpunto gpunto commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Goal

The XML MessageListViewModel exposes channelState, the Compose one does not. Compose apps that need loading or the
live members have to look the state up in the client's state registry instead.

Closes AND-1570

Implementation

  • Add channelState: StateFlow<ChannelState?> to the Compose MessageListViewModel, backed by the controller's flow,
    same as the XML view model.

Testing

MessageListViewModelTest checks the view model exposes the channel state the message list observes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • The message list now provides access to the channel’s current state, which updates while the conversation is open. Applications can observe this state and use it to keep channel-related information in sync. The state may be unavailable when no channel state has been provided.

@gpunto gpunto added the pr:improvement Improvement label Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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 (or ignored for dependabot PRs).

🎉 Great job! This PR is ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.26 MB 5.32 MB 0.06 MB 🟢
stream-chat-android-offline 5.49 MB 5.54 MB 0.05 MB 🟢
stream-chat-android-ui-components 10.64 MB 10.76 MB 0.11 MB 🟢
stream-chat-android-compose 12.87 MB 13.15 MB 0.28 MB 🟡

@gpunto
gpunto marked this pull request as ready for review September 25, 2026 10:23
@gpunto
gpunto requested a review from a team as a code owner September 25, 2026 10:23
@gpunto
gpunto enabled auto-merge (squash) September 25, 2026 10:24
@coderabbitai

coderabbitai Bot commented Sep 25, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 8da1dd0a-4593-440f-8dc7-e9f419db1aca

📥 Commits

Reviewing files that changed from the base of the PR and between 2a06294 and d444cdb.

📒 Files selected for processing (3)
  • stream-chat-android-compose/api/stream-chat-android-compose.api
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/messages/MessageListViewModel.kt
  • stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/viewmodel/messages/MessageListViewModelTest.kt

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

MessageListViewModel now exposes the controller’s nullable ChannelState as a StateFlow. The public API declaration includes the accessor, and a test checks that the exposed value is the same instance as the fixture’s ChannelState.

Changes

Channel state exposure

Layer / File(s) Summary
Expose and verify channel state
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/messages/MessageListViewModel.kt, stream-chat-android-compose/api/stream-chat-android-compose.api, stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/viewmodel/messages/MessageListViewModelTest.kt
MessageListViewModel exposes the controller’s nullable ChannelState as a StateFlow. The API declaration reflects the accessor, and a test verifies instance identity.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to d444c

The Compose view model exposes the controller's channel state, with matching API metadata and a test of the exposed value. No actionable merge risk is evident.

Security Architecture Review

Security architecture risk: 🔵 Low · up to d444c

The new API makes channel state easier for an app to observe, including messages and member information. It forwards an existing read-only state flow rather than adding a new write operation or apparent authorization path. No security finding was established, but downstream use of the new public API is not fully known.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The added exposure reaches callers of this Compose ViewModel within the host application. The inspected property does not itself extend that reach to a remote caller or a new privileged sink.

Trust Boundaries and Controls

  • inferred — The change forwards client-owned state through a read-only StateFlow and adds no visible mutation or authorization operation. Channel data remains significant to consumers, but the inspected path does not show a trust-boundary bypass.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: exposing channel state from the Compose MessageListViewModel.
Description check ✅ Passed The description includes the goal, implementation, linked issue, and testing details. UI sections are not relevant to this API change, although the contributor and reviewer checklist sections are not …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

A rabbit checks the channel stream,
The state flows softly, clear and keen.
One instance passes through the view,
A test confirms the link is true.
Then hops away beneath the moon.

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

@andremion andremion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. One optional nit inline.

@sonarqubecloud

Copy link
Copy Markdown

@gpunto
gpunto merged commit a1b5505 into v6 Sep 28, 2026
19 checks passed
@gpunto
gpunto deleted the feat/v6-compose-message-list-channel-state branch September 28, 2026 10:00
@stream-public-bot stream-public-bot added the released Included in a release label Sep 28, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v6.45.0

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

Labels

pr:improvement Improvement released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants