Skip to content

Conversation

@VelikovPetar
Copy link
Contributor

🎯 Goal

Resolves two issues which can result in multiple unnecessary calls to GetOrCreateChannel when paginating messages in a channel:

  1. Don't call loadOlderMessages if MessageListController is already loading older messages
  2. Don't call fillTheGap if ChannelLogic is loading older/newer messages. In this case, there will be no gap to be filled, so any calls to it are redundant.

🛠 Implementation details

  1. Add guard for loadingOlderMessages in MessageListController.loadOlderMessages
  2. Call ChannelLogic.fillTheGap ONLY when loading messages around ID (isFilteringAroundIdMessages)

🎨 UI Changes

NA

🧪 Testing

  1. Open a channel
  2. Scroll backwards (to load older messages)
  3. Each page load should trigger ONLY 1 GetOrCreateChannel call (POST https://chat.stream-io-api.com/channels/<channelType>/<channelId>/query)
  4. Observe the logs for no duplicate calls when paginating

@VelikovPetar VelikovPetar marked this pull request as ready for review November 24, 2025 09:15
@VelikovPetar VelikovPetar requested a review from a team as a code owner November 24, 2025 09:15
@github-actions
Copy link
Contributor

github-actions bot commented Nov 24, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.25 MB 0.00 MB 🟢
stream-chat-android-offline 5.48 MB 5.48 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.59 MB 10.59 MB 0.00 MB 🟢
stream-chat-android-compose 12.81 MB 12.81 MB 0.00 MB 🟢

@VelikovPetar VelikovPetar enabled auto-merge (squash) November 28, 2025 12:38
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@VelikovPetar VelikovPetar merged commit b14dc9e into develop Nov 28, 2025
12 of 13 checks passed
@VelikovPetar VelikovPetar deleted the bug/AND-917_prevent_duplicate_pagination_calls branch November 28, 2025 12:49
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.

4 participants