@@ -45,20 +45,20 @@ class ActivityData implements Identifiable {
4545 final newLatestReactions = [...latestReactions];
4646 final newReactionGroups =
4747 Map <String , ReactionGroupData >.from (reactionGroups);
48- var newOwnReactions = ownReactions;
48+ var newOwnReactions = [... ownReactions] ;
4949
5050 reaction.updateByAdding (
51- to: [...latestReactions] ,
51+ to: newLatestReactions ,
5252 reactionGroups: newReactionGroups,
5353 );
5454 if (reaction.user.id == currentUserId) {
55- newOwnReactions = ownReactions .insertById (reaction);
55+ newOwnReactions = newOwnReactions .insertById (reaction);
5656 }
5757
5858 return copyWith (
59- reactionCount: reactionCount + 1 ,
59+ reactionCount: newLatestReactions.length ,
6060 latestReactions: List .unmodifiable (newLatestReactions),
61- ownReactions: newOwnReactions,
61+ ownReactions: List . unmodifiable ( newOwnReactions) ,
6262 reactionGroups: Map .unmodifiable (newReactionGroups),
6363 );
6464 }
@@ -68,20 +68,20 @@ class ActivityData implements Identifiable {
6868 final newLatestReactions = [...latestReactions];
6969 final newReactionGroups =
7070 Map <String , ReactionGroupData >.from (reactionGroups);
71- var newOwnReactions = ownReactions;
71+ var newOwnReactions = [... ownReactions] ;
7272
7373 reaction.updateByRemoving (
74- to: [...latestReactions] ,
74+ to: newLatestReactions ,
7575 reactionGroups: newReactionGroups,
7676 );
7777 if (reaction.user.id == currentUserId) {
78- newOwnReactions = ownReactions .removeById (reaction);
78+ newOwnReactions = newOwnReactions .removeById (reaction);
7979 }
8080
8181 return copyWith (
82- reactionCount: reactionCount - 1 ,
82+ reactionCount: newLatestReactions.length ,
8383 latestReactions: List .unmodifiable (newLatestReactions),
84- ownReactions: newOwnReactions,
84+ ownReactions: List . unmodifiable ( newOwnReactions) ,
8585 reactionGroups: Map .unmodifiable (newReactionGroups),
8686 );
8787 }
0 commit comments