diff --git a/lib/src/screens/entries/entry_comment.dart b/lib/src/screens/entries/entry_comment.dart index 4d7668c..b757b85 100644 --- a/lib/src/screens/entries/entry_comment.dart +++ b/lib/src/screens/entries/entry_comment.dart @@ -119,9 +119,11 @@ class _EntryCommentState extends State { .asMap() .entries .map((item) => EntryComment(item.value, (newValue) { + var newChildren = [...widget.comment.children!]; + newChildren[item.key] = newValue; widget.onUpdate(widget.comment.copyWith( childCount: widget.comment.childCount + 1, - children: [newValue, ...widget.comment.children!], + children: newChildren, )); })) .toList(), diff --git a/lib/src/screens/posts/post_comment.dart b/lib/src/screens/posts/post_comment.dart index 2d71c2a..79d38ba 100644 --- a/lib/src/screens/posts/post_comment.dart +++ b/lib/src/screens/posts/post_comment.dart @@ -119,9 +119,11 @@ class _EntryCommentState extends State { .asMap() .entries .map((item) => PostComment(item.value, (newValue) { + var newChildren = [...widget.comment.children!]; + newChildren[item.key] = newValue; widget.onUpdate(widget.comment.copyWith( childCount: widget.comment.childCount + 1, - children: [newValue, ...widget.comment.children!], + children: newChildren, )); })) .toList(),