From ed0060ffcbc08ad222b83b694061a9c29dacdeb1 Mon Sep 17 00:00:00 2001 From: igoradamenko Date: Fri, 18 May 2018 23:34:58 +0300 Subject: [PATCH] fix adding comments to local store --- web/app/components/root/root.jsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/app/components/root/root.jsx b/web/app/components/root/root.jsx index 56ccaddc..d705aacb 100644 --- a/web/app/components/root/root.jsx +++ b/web/app/components/root/root.jsx @@ -33,6 +33,7 @@ export default class Root extends Component { sort, }; + this.addComment = this.addComment.bind(this); this.replaceComment = this.replaceComment.bind(this); this.onSignIn = this.onSignIn.bind(this); this.onSignOut = this.onSignOut.bind(this); @@ -157,6 +158,11 @@ export default class Root extends Component { this.setState({ wasSomeoneUnblocked: true }); } + addComment(comment) { + store.addComment(comment); + this.setState({ comments: store.get('comments') }); + } + replaceComment(comment) { store.replaceComment(comment); this.setState({ comments: store.get('comments') }); @@ -199,7 +205,7 @@ export default class Root extends Component { ) } @@ -229,7 +235,7 @@ export default class Root extends Component { mix="root__thread" mods={{ level: 0 }} data={thread} - onReply={this.replaceComment} + onReply={this.addComment} onEdit={this.replaceComment} /> ))