Skip to content

Conversation

@andremion
Copy link
Contributor

@andremion andremion commented Oct 10, 2025

🎯 Goal

Preserve scroll position during configuration changes in the MessageList by preventing automatic scroll-to-bottom behavior when the same new message state is restored after a configuration change.

🛠 Implementation details

  • Introduces state preservation logic using rememberSaveable to track the last new message state that triggered scroll-to-bottom
  • Adds custom Saver implementations for NewMessageState and MutableState<NewMessageState?> to handle serialization across configuration changes
  • Modifies scroll-to-bottom logic to only trigger when the new message state differs from the previously saved state

🎨 UI Changes

Before After
Screen.Recording.2025-10-10.at.09.43.07.mov
Screen.Recording.2025-10-10.at.09.42.18.mov

🧪 Testing

  • Given that the last message is the current user's message.
  • Scroll far from the bottom in the message list, then rotate the screen.
  • Scroll far from the bottom in the message list, start and stop typing from the other chat member.
  • Scroll far from the bottom in the message list, type and send a message.

@andremion andremion requested a review from Copilot October 10, 2025 08:39
@andremion andremion added the compose Jetpack Compose label Oct 10, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR preserves scroll position during configuration changes in the MessageList by preventing automatic scroll-to-bottom behavior when the same new message state is restored after a configuration change.

  • Introduces state preservation logic using rememberSaveable to track the last new message state that triggered scroll-to-bottom
  • Adds custom Saver implementations for NewMessageState and MutableState<NewMessageState?> to handle serialization across configuration changes
  • Modifies scroll-to-bottom logic to only trigger when the new message state differs from the previously saved state

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 10, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.22 MB 3.22 MB 0.00 MB 🟢
stream-chat-android-offline 3.45 MB 3.45 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.54 MB 10.54 MB 0.00 MB 🟢
stream-chat-android-compose 12.75 MB 12.75 MB 0.00 MB 🟢

@andremion andremion marked this pull request as ready for review October 10, 2025 09:07
@andremion andremion requested a review from a team as a code owner October 10, 2025 09:07
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@VelikovPetar VelikovPetar merged commit 676a931 into develop Oct 10, 2025
12 of 13 checks passed
@VelikovPetar VelikovPetar deleted the AND-833-messagelist-is-scrolled-to-bottom-after-the-first-orientation branch October 10, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compose Jetpack Compose

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants