Skip to content

Commit

Permalink
fix: feed bloc query and add activities (#207)
Browse files Browse the repository at this point in the history
Co-authored-by: Sacha Arbonel <[email protected]>
  • Loading branch information
HayesGordon and sachaarbonel authored Feb 28, 2022
1 parent dd139b0 commit cb2e051
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
6 changes: 6 additions & 0 deletions packages/stream_feed_flutter_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.7.0+1 28/02/2022

- fixes(FeedBloc):
- bug when adding to a fix lengthed list
- change the init behavior of queryEnrichedActivities (to allow it to be called again)

## 0.7.0 25/02/2022

- fix: `FeedProvider` inherited widget had an issue with the `updateShouldNotify` being triggered everytime. This has been fixed via the llc, being bumped to 0.5.1.
Expand Down
15 changes: 7 additions & 8 deletions packages/stream_feed_flutter_core/lib/src/bloc/feed_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class GenericFeedBloc<A, Ob, T, Or> extends Equatable {
final enrichedActivity = await flatFeed
.getEnrichedActivityDetail<A, Ob, T, Or>(addedActivity.id!);

final _activities = getActivities(feedGroup) ?? [];
final _activities = (getActivities(feedGroup) ?? []).toList();

// ignore: cascade_invocations
_activities.insert(0, enrichedActivity);
Expand Down Expand Up @@ -435,13 +435,13 @@ class GenericFeedBloc<A, Ob, T, Or> extends Equatable {

//TODO: no way to parameterized marker?
}) async {
activitiesManager.init(feedGroup);
if (_queryActivitiesLoadingController.value == true) return;

if (activitiesManager.hasValue(feedGroup)) {
_queryActivitiesLoadingController.add(true);
if (_queryActivitiesLoadingController.value == true) {
return; // already loading
}

if (!activitiesManager.hasValue(feedGroup)) {
activitiesManager.init(feedGroup);
}
_queryActivitiesLoadingController.add(true);
try {
final activitiesResponse = await client
.flatFeed(feedGroup, userId)
Expand All @@ -453,7 +453,6 @@ class GenericFeedBloc<A, Ob, T, Or> extends Equatable {
flags: flags,
ranking: ranking,
);

activitiesManager.add(feedGroup, activitiesResponse);
if (activitiesManager.hasValue(feedGroup) &&
_queryActivitiesLoadingController.value) {
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_feed_flutter_core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: stream_feed_flutter_core
description: Stream Feed official Flutter SDK Core. Build your own feed experience using Dart and Flutter.
version: 0.7.0
version: 0.7.0+1
repository: https://github.com/GetStream/stream-feed-flutter
issue_tracker: https://github.com/GetStream/stream-feed-flutter/issues
homepage: https://getstream.io/
Expand Down

0 comments on commit cb2e051

Please sign in to comment.