Skip to content

Conversation

@xsahil03x
Copy link
Member

@xsahil03x xsahil03x commented Dec 17, 2025

Android PR: GetStream/stream-feeds-android#148

Summary by CodeRabbit

  • Refactor
    • Restructured feed data organization to separate pagination handling from activity collections.
    • Simplified activity query system and removed configuration-based sorting mechanisms.
    • Updated how activity data is accessed and merged during pagination operations.

✏️ Tip: You can customize this high-level summary in your review settings.

@xsahil03x xsahil03x requested a review from a team as a code owner December 17, 2025 11:05
@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Walkthrough

The pull request restructures the GetOrCreateFeedData model by decoupling pagination from activities. It removes activitiesQueryConfig, introduces a new PaginationData field, and changes activities from PaginationResult<ActivityData> to List<ActivityData>. These model changes cascade through generated code, repository, and state management layers.

Changes

Cohort / File(s) Summary
Model definition
packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
Added required pagination: PaginationData field; changed activities from PaginationResult<ActivityData> to List<ActivityData>; removed activitiesQueryConfig parameter and import of query_configuration.dart.
Generated freezed code
packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
Updated mixin and equality/hashCode/toString implementations to reflect new pagination field and separate activities list; removed activitiesQueryConfig from equality checks; updated $GetOrCreateFeedDataCopyWith interface to accept new field structure.
Repository data wiring
packages/stream_feeds/lib/src/repository/feeds_repository.dart
Refactored getOrCreateFeed to construct GetOrCreateFeedData with top-level pagination and plain activities list instead of PaginationResult with activitiesQueryConfig; removed related imports; added handling for followRequests and members pagination.
State management
packages/stream_feeds/lib/src/state/feed.dart, packages/stream_feeds/lib/src/state/feed_state.dart
Updated activity collection access patterns to use feedData.activities directly instead of feedData.activities.items; changed onQueryMoreActivities signature to accept PaginationData pagination instead of QueryConfiguration<ActivityData> queryConfig; simplified activity merging and capability caching logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Field access pattern updates: Verify .items accessor removal is complete and correct across all files; ensure pagination field is accessed properly in state management.
  • Repository wiring: Confirm PaginationData construction from response fields (next/prev) and members pagination fallback logic are correct.
  • State mutation logic: Review onQueryMoreActivities merge logic and onActivityUpdated simplification (upsert vs. sortedUpsert change).
  • Freezed generation: Validate equality, hashCode, and copyWith implementations match new field layout.

Suggested reviewers

  • renefloor

Poem

🐰 Our feeds now flow with cleaner stride,
Pagination and activities, no longer hide,
Freed from config's tangled chain,
Simpler state, a lighter refrain! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. While it references a related Android PR, it lacks required sections including a proper description of changes, testing information, and CLA confirmation. Fill in the 'Description of the pull request' section explaining the refactoring rationale and testing approach. Complete required CLA and best practices checkboxes.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main refactoring: removing client-side sorting from feeds. It aligns with the significant structural changes documented in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/remove-client-side-sorting-from-feeds

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c733303 and 35874b3.

📒 Files selected for processing (5)
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart (1 hunks)
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart (6 hunks)
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart (1 hunks)
  • packages/stream_feeds/lib/src/state/feed.dart (2 hunks)
  • packages/stream_feeds/lib/src/state/feed_state.dart (4 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.dart

📄 CodeRabbit inference engine (.cursor/rules/cursor-rules-location.mdc)

**/*.dart: Use the barrel_files package with @includeInBarrelFile annotations for public API management in Dart projects; keep implementation details in lib/src/ without annotations
Mark only classes, functions, and enums intended for external package usage with @includeInBarrelFile; keep repository classes, mappers, and internal state objects in lib/src/ without annotations

**/*.dart: Use @freezed mixed mode for data classes in Dart
Return Result<T> from all repository methods in Dart
Apply early return patterns consistently in Dart code
Use pattern matching with switch expressions in Dart
Mark public APIs with @includeInBarrelFile annotation in Dart
Follow enhanced enum vs sealed class guidelines in Dart
Use const constructors where possible in Dart
Implement proper disposal patterns in Dart StateNotifiers and providers
Ensure pure Dart compatibility across VM, Flutter, and Web environments
Plan for StateNotifier reactive patterns when implementing state management in Dart

**/*.dart: Use @freezed for all data classes with required id fields and const constructors
Implement StateNotifier-based reactive state management with automatic change notifications
Apply Result pattern for all async operations with explicit error handling
Use early return patterns for clean control flow in Dart code
Create extension functions for data mapping using .toModel() pattern instead of mapper classes
Mark public APIs with @includeInBarrelFile annotation for barrel file export management
Implement proper resource management with disposal and cleanup patterns in Dart code
Use constructor injection for all dependencies in Dart classes

**/*.dart: All data models should use @freezed with Dart's mixed mode syntax and include @OverRide annotations on fields
Mark classes for public export using @includeInBarrelFile annotation
Use extension functions with .toModel() convention for data mapping instead of dedicated mapper classes
All repository methods must return Result...

Files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
packages/stream_feeds/lib/src/state/**/*.dart

📄 CodeRabbit inference engine (AGENTS.md)

packages/stream_feeds/lib/src/state/**/*.dart: State classes must use @freezed with const constructors
State class naming convention: Use *State suffix for state classes (e.g., FeedState, ActivityListState)

Files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
packages/stream_feeds/lib/src/**/*.dart

📄 CodeRabbit inference engine (AGENTS.md)

Use // for internal/private code documentation

Files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
packages/stream_feeds/lib/**/*.dart

📄 CodeRabbit inference engine (AGENTS.md)

Apply Dart analyzer configuration from analysis_options.yaml for code quality

Files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
packages/stream_feeds/lib/src/models/**/*.dart

📄 CodeRabbit inference engine (AGENTS.md)

packages/stream_feeds/lib/src/models/**/*.dart: Use @freezed for all data classes in the Stream Feeds SDK
Follow Freezed 3.0 mixed mode syntax with @override annotations for fields
All models should have an id field when representing entities
Place custom data fields last in constructors and class definitions
Model naming convention: Use *Data suffix for model classes (e.g., ActivityData, FeedData)
Query naming convention: Use *Query suffix for query classes (e.g., ActivitiesQuery, FeedsQuery)
Request naming convention: Use *Request suffix for request classes (e.g., FeedAddActivityRequest)

Files:

  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
packages/stream_feeds/lib/src/repository/**/*.dart

📄 CodeRabbit inference engine (AGENTS.md)

packages/stream_feeds/lib/src/repository/**/*.dart: All repository methods must return Result<T> types for explicit error handling
Use early return patterns for validation and errors in repository methods
Use extension functions for API-to-domain model mapping in repositories
Never throw exceptions in repositories - always return Result types

Files:

  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
🧠 Learnings (29)
📓 Common learnings
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Request naming convention: Use `*Request` suffix for request classes (e.g., `FeedAddActivityRequest`)
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/stream_feeds.dart : Keep public API minimal - most code should be in `lib/src/` internal directory

Applied to files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:37:17.519Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-api.mdc:0-0
Timestamp: 2025-12-05T14:37:17.519Z
Learning: Applies to {**/api/**/*.dart,**/*_api.dart,**/client/*.dart} : Stream Feeds API integration should be implemented according to the Activity Streams specification with structured actor, verb, object, and target fields

Applied to files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/stream_feeds.dart : Follow Effective Dart documentation guidelines for all public APIs

Applied to files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Query naming convention: Use `*Query` suffix for query classes (e.g., `ActivitiesQuery`, `FeedsQuery`)

Applied to files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/stream_feeds.dart : Export public API classes from main library entry point `lib/stream_feeds.dart`

Applied to files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/state/**/*.dart : State class naming convention: Use `*State` suffix for state classes (e.g., `FeedState`, `ActivityListState`)

Applied to files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/repository/**/*.dart : Use extension functions for API-to-domain model mapping in repositories

Applied to files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/stream_feeds.dart : Use `///` for public API documentation in exported classes and methods

Applied to files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Model naming convention: Use `*Data` suffix for model classes (e.g., `ActivityData`, `FeedData`)

Applied to files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Request naming convention: Use `*Request` suffix for request classes (e.g., `FeedAddActivityRequest`)

Applied to files:

  • packages/stream_feeds/lib/src/state/feed.dart
  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/state/**/*StateNotifier.dart : Use StateNotifier for reactive state management

Applied to files:

  • packages/stream_feeds/lib/src/state/feed_state.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/state/**/*StateNotifier.dart : StateNotifier naming convention: Use `*StateNotifier` suffix for StateNotifier implementations (e.g., `FeedStateNotifier`)

Applied to files:

  • packages/stream_feeds/lib/src/state/feed_state.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/test/**/*.dart : Test through public APIs only, not internal StateNotifier implementations

Applied to files:

  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:37:37.953Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-sdk.mdc:0-0
Timestamp: 2025-12-05T14:37:37.953Z
Learning: Applies to **/*.dart : Define separate query specifications from data models using freezed classes

Applied to files:

  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:37:37.953Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-sdk.mdc:0-0
Timestamp: 2025-12-05T14:37:37.953Z
Learning: Applies to **/*.dart : Use Dart's type-safe queries for API operations with freezed query specifications

Applied to files:

  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Use `freezed` for all data classes in the Stream Feeds SDK

Applied to files:

  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/state/**/*.dart : State classes must use `freezed` with const constructors

Applied to files:

  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Follow Freezed 3.0 mixed mode syntax with `override` annotations for fields

Applied to files:

  • packages/stream_feeds/lib/src/state/feed_state.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Place custom data fields last in constructors and class definitions

Applied to files:

  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : All models should have an `id` field when representing entities

Applied to files:

  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/generated/**/*.dart : Never manually edit generated files (`*.freezed.dart`, `*.g.dart`, `src/generated/`)

Applied to files:

  • packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/repository/**/*.dart : Use early return patterns for validation and errors in repository methods

Applied to files:

  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/repository/**/*.dart : Never throw exceptions in repositories - always return Result types

Applied to files:

  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/repository/**/*.dart : All repository methods must return `Result<T>` types for explicit error handling

Applied to files:

  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/stream_feeds.dart : Include examples for complex APIs in documentation

Applied to files:

  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/generated/**/*.dart : Never manually edit OpenAPI-generated API code files in `src/generated/`

Applied to files:

  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:37:17.519Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-api.mdc:0-0
Timestamp: 2025-12-05T14:37:17.519Z
Learning: Applies to {**/api/**/*.dart,**/*_api.dart,**/client/*.dart} : Implement proper authentication using API keys and user tokens via the StreamFeedsClient with tokenProvider parameter

Applied to files:

  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/**/*.dart : Use `//` for internal/private code documentation

Applied to files:

  • packages/stream_feeds/lib/src/repository/feeds_repository.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: stream_feeds
  • GitHub Check: build
  • GitHub Check: analyze
🔇 Additional comments (13)
packages/stream_feeds/lib/src/state/feed.dart (4)

128-131: LGTM! Capabilities caching updated correctly.

The change correctly adapts to the new data structure where activities is a direct list. The use of .nonNulls appropriately filters nullable currentFeed values.


466-472: LGTM! Pagination handling updated correctly.

The change from activitiesQueryConfig to pagination aligns with the refactoring to decouple pagination from the activities collection.


474-480: LGTM! Capabilities caching for additional activities is correct.

The change correctly adapts to the new data structure, maintaining consistency with the initial capabilities caching logic.


483-483: LGTM! Return value correctly updated.

The return statement correctly accesses the activities list directly, matching the new data structure.

packages/stream_feeds/lib/src/state/feed_state.dart (3)

55-75: LGTM! Feed query handling updated correctly.

The changes correctly adapt to the new data structure where activities and pagination are separate fields. The member list synchronization logic is preserved appropriately.


77-99: LGTM! Query more activities simplified effectively.

The signature change from PaginationResult<ActivityData> to List<ActivityData> and QueryConfiguration<ActivityData> to PaginationData successfully decouples pagination from the activities collection, aligning with the goal of removing client-side sorting.


126-131: The change from sortedUpsert to upsert in FeedState.onActivityUpdated is correct and intentional. This is not an inconsistency with other state classes.

Key difference in architecture:

  • FeedState has no sort configuration mechanism (FeedQuery has no sort field, FeedStateNotifier has no activitiesSort getter)
  • ActivityListState manages client-side sorting with a _queryConfig and explicit activitiesSort getter
  • Activities in FeedState are pre-sorted by the API and directly assigned without re-sorting

Using upsert instead of sortedUpsert is correct because:

  1. FeedState cannot apply client-side sorting (no configuration available)
  2. upsert preserves the existing order from the API while updating individual items
  3. Re-implementing the API's sorting logic on the client would be redundant and incorrect

No action needed.

packages/stream_feeds/lib/src/models/get_or_create_feed_data.dart (2)

21-32: LGTM! Constructor updated correctly.

The constructor changes align with the refactoring goals. The use of const [] for default values and proper field ordering follows Dart best practices.


34-44: LGTM! Field definitions align with refactoring.

The field definitions correctly separate pagination from activities, and the documentation accurately describes each field's purpose. The model follows coding guidelines with proper naming and annotations.

packages/stream_feeds/lib/src/models/get_or_create_feed_data.freezed.dart (3)

17-27: LGTM! Generated getters are correct.

The generated code correctly reflects the model changes with proper types for pagination, activities, and aggregatedActivities.


38-78: LGTM! Generated equality and hash implementations are correct.

The generated code properly uses DeepCollectionEquality for list comparisons and handles the new pagination field appropriately in equality, hash, and toString methods.


80-166: LGTM! Generated copyWith implementation is correct.

The copyWith implementation properly handles the new field structure with appropriate null-safety checks and type casts following standard freezed patterns.

packages/stream_feeds/lib/src/repository/feeds_repository.dart (1)

51-78: LGTM! Repository mapping updated correctly.

The mapping from API response to GetOrCreateFeedData correctly separates pagination and activities. The use of extension functions (.toModel()) follows coding guidelines for repository-to-domain mapping. The switch expression for member pagination with empty fallback is a clean approach.


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.

@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 59.90%. Comparing base (c733303) to head (35874b3).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ackages/stream_feeds/lib/src/state/feed_state.dart 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #72      +/-   ##
==========================================
- Coverage   60.05%   59.90%   -0.15%     
==========================================
  Files         121      121              
  Lines        3790     3774      -16     
==========================================
- Hits         2276     2261      -15     
+ Misses       1514     1513       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xsahil03x xsahil03x merged commit 2390fe4 into main Dec 18, 2025
11 checks passed
@xsahil03x xsahil03x deleted the refactor/remove-client-side-sorting-from-feeds branch December 18, 2025 12:17
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.

3 participants