Skip to content

Commit 7e5e4b1

Browse files
committed
chore: minor changes
1 parent b006982 commit 7e5e4b1

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

melos.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ command:
4040
state_notifier: ^1.0.0
4141
uuid: ^4.5.1
4242

43+
# TODO Replace with hosted version when published
4344
stream_core:
4445
git:
4546
url: https://github.com/GetStream/stream-core-flutter.git

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ extension ThreadedCommentDataMutations on ThreadedCommentData {
298298
ThreadedCommentData reply,
299299
Comparator<CommentsSortDataFields> comparator,
300300
) {
301-
final updatedReplies = (replies ?? []).sortedUpsert(
301+
final currentReplies = replies ?? [];
302+
final updatedReplies = currentReplies.sortedUpsert(
302303
reply,
303304
key: (it) => it.id,
304305
compare: comparator,
@@ -315,7 +316,10 @@ extension ThreadedCommentDataMutations on ThreadedCommentData {
315316
/// @param comment The reply comment to remove.
316317
/// @return A new [ThreadedCommentData] instance with the updated replies and reply count.
317318
ThreadedCommentData removeReply(ThreadedCommentData reply) {
318-
final updatedReplies = replies?.where((it) => it.id != reply.id).toList();
319+
final currentReplies = replies ?? [];
320+
final updatedReplies = currentReplies.where((it) {
321+
return it.id != reply.id;
322+
}).toList();
319323

320324
return copyWith(
321325
replies: updatedReplies,
@@ -331,7 +335,8 @@ extension ThreadedCommentDataMutations on ThreadedCommentData {
331335
ThreadedCommentData reply,
332336
Comparator<CommentsSortDataFields> comparator,
333337
) {
334-
final updatedReplies = replies?.sortedUpsert(
338+
final currentReplies = replies ?? [];
339+
final updatedReplies = currentReplies.sortedUpsert(
335340
reply,
336341
key: (it) => it.id,
337342
compare: comparator,

packages/stream_feeds/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ dependencies:
3333
retrofit: ^4.6.0
3434
rxdart: ^0.28.0
3535
state_notifier: ^1.0.0
36-
# TODO Replace with hosted version when published
3736
stream_core:
3837
git:
3938
url: https://github.com/GetStream/stream-core-flutter.git

0 commit comments

Comments
 (0)