-
Notifications
You must be signed in to change notification settings - Fork 1
refactor(llc): refactor FilterField and SortField to support local filtering #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit refactors `FilterField` and `SortField` from `extension type` to `class` to enable local, client-side filtering and sorting capabilities. Key changes: - `FilterField` and `SortField` in all query files are now classes that hold both a remote string value for the API and a local value accessor function. - `QueryConfiguration` is now generic over the data type `T` (`QueryConfiguration<T>`) instead of separate `Sort` and `FilterField` types. - Typedefs for filters (e.g., `ActivitiesFilter = Filter<ActivityData>`) have been added for clarity. - `FeedData.fid` has been renamed to `FeedData.feed` for consistency. - Updated various state holders and doc snippets to align with the new generic query and field structures.
Pass the `query` object to all `EventHandler` instances instead of individual properties like `fid`. This allows event handlers to access the query's filter conditions. When a real-time "updated" event is received, the handler now checks if the updated item still matches the filter. If it no longer matches, the item is removed from the local state, ensuring the UI stays consistent with the query's criteria.
This commit updates the `stream_core` dependency from `^0.2.0` to `^0.3.0` in both `melos.yaml` and `packages/stream_feeds/pubspec.yaml`.
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (49.87%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
===========================================
+ Coverage 20.88% 40.86% +19.97%
===========================================
Files 120 120
Lines 3289 3617 +328
===========================================
+ Hits 687 1478 +791
+ Misses 2602 2139 -463 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This commit refactors the test suite to use the abstract `StreamFeedsClient` class instead of the concrete `StreamFeedsClientImpl` implementation. This change improves test isolation by programming against the public API contract rather than the internal implementation details. Key changes: - Updated all test files to instantiate and reference `StreamFeedsClient`. - Removed direct imports of `feeds_client_impl.dart` from the test suite. - Removed the unnecessary Flutter SDK dependency from `pubspec.yaml`. - Exposed `WebSocketProvider` and `DefaultApi` as `@visibleForTesting` parameters in the `StreamFeedsClient` factory constructor to facilitate mocking.
| @visibleForTesting WebSocketProvider? wsProvider, | ||
| @visibleForTesting api.DefaultApi? feedsRestApi, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason you added these to the public interface? By using StreamFeedsClientImpl in the tests we don't really need that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should test internal implementation. We should only test the public API's
Submit a pull request
Closes: FLU-305
Requires: GetStream/stream-core-flutter#16
Description of the pull request
This PR refactors
FilterFieldandSortFieldfromextension typetoclassto enable local, client-side filtering and sorting capabilities.Key changes:
FilterFieldandSortFieldin all query files are now classes that hold both a remote string value for the API and a local value accessor function.QueryConfigurationis now generic over the data typeT(QueryConfiguration<T>) instead of separateSortandFilterFieldtypes.ActivitiesFilter = Filter<ActivityData>) have been added for clarity.FeedData.fidhas been renamed toFeedData.feedfor consistency.