Skip to content

Commit 2f56693

Browse files
committed
debug logs
1 parent 1dd5fc8 commit 2f56693

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

packages/stream_feeds/lib/src/models/activity_data.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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

packages/stream_feeds/lib/src/state/feed_state.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)