File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
packages/stream_feeds/lib/src Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -317,9 +317,15 @@ extension ActivityDataMutations on ActivityData {
317317 false => ownBookmarks,
318318 };
319319
320+ var updatedCount = bookmarkCount;
321+ if (updatedOwnBookmarks.length != ownBookmarks.length) {
322+ updatedCount++ ;
323+ print (
324+ 'updatedCount: $updatedCount , ownBookmarks: ${ownBookmarks .length }, updatedOwnBookmarks: ${updatedOwnBookmarks .length }' );
325+ }
320326 return copyWith (
321327 ownBookmarks: updatedOwnBookmarks,
322- bookmarkCount: math.max (0 , bookmarkCount + 1 ),
328+ bookmarkCount: math.max (0 , updatedCount ),
323329 );
324330 }
325331
Original file line number Diff line number Diff line change @@ -192,7 +192,15 @@ class FeedStateNotifier extends StateNotifier<FeedState> {
192192 // Add or update the bookmark in the activity
193193 final updatedActivities = state.activities.map ((activity) {
194194 if (activity.id != bookmark.activity.id) return activity;
195- return activity.addBookmark (bookmark, currentUserId);
195+
196+ print (
197+ 'updatedCount: newActivity ${activity .id }: ${activity .bookmarkCount }, ownBookmarks: ${activity .ownBookmarks .length }' ,
198+ );
199+ final newActivity = activity.addBookmark (bookmark, currentUserId);
200+ print (
201+ 'updatedCount: newActivity ${activity .id }: ${newActivity .bookmarkCount }, ownBookmarks: ${newActivity .ownBookmarks .length }' ,
202+ );
203+ return newActivity;
196204 }).toList ();
197205
198206 state = state.copyWith (activities: updatedActivities);
You can’t perform that action at this time.
0 commit comments