Adding key to comment-node to not clear out form. Fixes #588

This commit is contained in:
Dessalines 2020-03-09 21:38:10 -04:00
parent 43cbc3de1f
commit ff6462cc02
2 changed files with 2 additions and 1 deletions

View file

@ -38,6 +38,7 @@ export class CommentNodes extends Component<
<div className="comments"> <div className="comments">
{this.sorter().map(node => ( {this.sorter().map(node => (
<CommentNode <CommentNode
key={node.comment.id}
node={node} node={node}
noIndent={this.props.noIndent} noIndent={this.props.noIndent}
viewOnly={this.props.viewOnly} viewOnly={this.props.viewOnly}

View file

@ -300,7 +300,7 @@ export class Post extends Component<any, PostState> {
i.setState(i.state); i.setState(i.state);
} }
private buildCommentsTree(): Array<CommentNodeI> { buildCommentsTree(): Array<CommentNodeI> {
let map = new Map<number, CommentNodeI>(); let map = new Map<number, CommentNodeI>();
for (let comment of this.state.comments) { for (let comment of this.state.comments) {
let node: CommentNodeI = { let node: CommentNodeI = {