Fix subcomments duplicating on update
This commit is contained in:
parent
341dcc48d0
commit
7f4b2dea7a
|
@ -119,9 +119,11 @@ class _EntryCommentState extends State<EntryComment> {
|
||||||
.asMap()
|
.asMap()
|
||||||
.entries
|
.entries
|
||||||
.map((item) => EntryComment(item.value, (newValue) {
|
.map((item) => EntryComment(item.value, (newValue) {
|
||||||
|
var newChildren = [...widget.comment.children!];
|
||||||
|
newChildren[item.key] = newValue;
|
||||||
widget.onUpdate(widget.comment.copyWith(
|
widget.onUpdate(widget.comment.copyWith(
|
||||||
childCount: widget.comment.childCount + 1,
|
childCount: widget.comment.childCount + 1,
|
||||||
children: [newValue, ...widget.comment.children!],
|
children: newChildren,
|
||||||
));
|
));
|
||||||
}))
|
}))
|
||||||
.toList(),
|
.toList(),
|
||||||
|
|
|
@ -119,9 +119,11 @@ class _EntryCommentState extends State<PostComment> {
|
||||||
.asMap()
|
.asMap()
|
||||||
.entries
|
.entries
|
||||||
.map((item) => PostComment(item.value, (newValue) {
|
.map((item) => PostComment(item.value, (newValue) {
|
||||||
|
var newChildren = [...widget.comment.children!];
|
||||||
|
newChildren[item.key] = newValue;
|
||||||
widget.onUpdate(widget.comment.copyWith(
|
widget.onUpdate(widget.comment.copyWith(
|
||||||
childCount: widget.comment.childCount + 1,
|
childCount: widget.comment.childCount + 1,
|
||||||
children: [newValue, ...widget.comment.children!],
|
children: newChildren,
|
||||||
));
|
));
|
||||||
}))
|
}))
|
||||||
.toList(),
|
.toList(),
|
||||||
|
|
Loading…
Reference in New Issue