diff --git a/packages/stream_feeds/CHANGELOG.md b/packages/stream_feeds/CHANGELOG.md index 9567bd0..ac5dab2 100644 --- a/packages/stream_feeds/CHANGELOG.md +++ b/packages/stream_feeds/CHANGELOG.md @@ -1,5 +1,6 @@ ## unreleased - Update follower and following counts on the feed state when receiving follow websocket events. +- Fix FeedsReactionData id for updating reactions in the feed state. ## 0.3.1 - Update API client with renaming `addReaction` to `addActivityReaction` and `deleteReaction` to `deleteActivityReaction`. diff --git a/packages/stream_feeds/lib/src/models/feeds_reaction_data.dart b/packages/stream_feeds/lib/src/models/feeds_reaction_data.dart index 3739bd2..3e47744 100644 --- a/packages/stream_feeds/lib/src/models/feeds_reaction_data.dart +++ b/packages/stream_feeds/lib/src/models/feeds_reaction_data.dart @@ -14,6 +14,7 @@ class FeedsReactionData with _$FeedsReactionData { /// Creates a new [FeedsReactionData] instance. const FeedsReactionData({ required this.activityId, + this.commentId, required this.createdAt, required this.type, required this.updatedAt, @@ -25,6 +26,8 @@ class FeedsReactionData with _$FeedsReactionData { @override final String activityId; + final String? commentId; + /// The date and time when the reaction was created. @override final DateTime createdAt; @@ -46,7 +49,8 @@ class FeedsReactionData with _$FeedsReactionData { final Map? custom; /// Unique identifier for the reaction, generated from the activity ID and user ID. - String get id => '$activityId${user.id}'; + String get id => + '${user.id}-$type${commentId == null ? '' : '-$commentId'}-$activityId'; } /// Extension function to convert a [FeedsReactionResponse] to a [FeedsReactionData] model. @@ -55,6 +59,7 @@ extension FeedsReactionResponseMapper on FeedsReactionResponse { FeedsReactionData toModel() { return FeedsReactionData( activityId: activityId, + commentId: commentId, createdAt: createdAt, type: type, updatedAt: updatedAt,