Fix subcomments duplicating on update
This commit is contained in:
parent
341dcc48d0
commit
7f4b2dea7a
|
@ -119,9 +119,11 @@ class _EntryCommentState extends State<EntryComment> {
|
|||
.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(),
|
||||
|
|
|
@ -119,9 +119,11 @@ class _EntryCommentState extends State<PostComment> {
|
|||
.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(),
|
||||
|
|
Loading…
Reference in New Issue