Skip to content

Conversation

@gpunto
Copy link
Contributor

@gpunto gpunto commented Nov 12, 2025

Goal

Part of AND-893.

Removing client-side sorting of activities in a feed as we can't assume a sort order for all feeds (e.g. "for you" feeds aren't necessarily sorted chronologically).

Implementation

Remove activitiesQueryConfig from different places, as the only thing we need to care about is the activity filter (query config contains filter + sorting).

Testing

Activities in feeds should be sorted in the order they came in.

Checklist

  • Issue linked (if any)
  • Tests/docs updated
  • I have signed the Stream CLA (required for external contributors)

@gpunto gpunto requested a review from Copilot November 12, 2025 15:58
@gpunto gpunto added the pr:bug Bug fix label Nov 12, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

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.

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 removes client-side sorting of activities in feeds to support different feed types (e.g., "for you" feeds) that may not follow chronological ordering. The change removes the activitiesQueryConfig parameter that was used to maintain sorting information.

Key changes:

  • Removed ActivitiesQueryConfig and related sorting logic from feed state management
  • Replaced mergeSorted/upsertSorted calls with upsertAll/upsert to preserve server-provided order
  • Removed activityFilter from pagination queries to avoid carrying over filters

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
FeedStateImpl.kt Removed sorting configuration tracking and replaced sorted merge/upsert operations with order-preserving variants
FeedImpl.kt Removed activityFilter from pagination queries to avoid filtering subsequent pages
FeedsRepositoryImpl.kt Removed manual sorting of activities in repository layer while keeping import for initial sort
FeedsRepository.kt Updated GetOrCreateInfo data class documentation and removed activitiesQueryConfig parameter
FeedStateImplTest.kt Removed test setup for query configuration and sorting-related test code
FeedImplTest.kt Removed query configuration from test data setup
FeedsRepositoryImplTest.kt Removed query configuration assertions from repository tests
Comments suppressed due to low confidence (1)

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/FeedsRepositoryImpl.kt:28

  • The import for ActivitiesSort on line 28 is now unused since the sorting logic has been removed. This import should be removed.
import io.getstream.feeds.android.client.api.state.query.ActivitiesSort

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-feeds-android-client 2.36 MB 2.36 MB -0.00 MB 🚀

@gpunto gpunto force-pushed the and-893/rm-sorting-from-feed branch 4 times, most recently from d2c1088 to 731ea42 Compare November 12, 2025 16:12
@gpunto gpunto marked this pull request as ready for review November 12, 2025 16:20
val query =
FeedQuery(
fid = fid,
activityFilter = _state.activitiesQueryConfig?.filter,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we not supposed to pass the original filter argument from the original query when loading the next page of activities?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦‍♂️ fixing it and adding a test

@gpunto gpunto force-pushed the and-893/rm-sorting-from-feed branch from 031e02e to 970fbb3 Compare November 13, 2025 09:50
@sonarqubecloud
Copy link

@VelikovPetar VelikovPetar merged commit da55844 into develop Nov 13, 2025
7 checks passed
@VelikovPetar VelikovPetar deleted the and-893/rm-sorting-from-feed branch November 13, 2025 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants