diff --git a/web/app/components/comment/comment.jsx b/web/app/components/comment/comment.jsx index 434ac481..3df27d26 100644 --- a/web/app/components/comment/comment.jsx +++ b/web/app/components/comment/comment.jsx @@ -65,15 +65,16 @@ export default class Comment extends Component { toggleInputVisibility() { const { isInputVisible } = this.state; + const onPrevReplyCb = store.get('onPrevReplyCb'); this.setState({ isInputVisible: !isInputVisible }); - if (this.props.onReplyClick) { - if (!isInputVisible) { - this.props.onReplyClick(() => this.setState({ isInputVisible: false })); - } else { - this.props.onReplyClick(null); - } + if (onPrevReplyCb) onPrevReplyCb(); + + if (!isInputVisible) { + store.set('onPrevReplyCb', () => this.setState({ isInputVisible: false })); + } else { + store.set('onPrevReplyCb', null); } } diff --git a/web/app/components/root/root.jsx b/web/app/components/root/root.jsx index 834e673f..a975f005 100644 --- a/web/app/components/root/root.jsx +++ b/web/app/components/root/root.jsx @@ -39,7 +39,6 @@ export default class Root extends Component { this.onSignOut = this.onSignOut.bind(this); this.onBlockedUsersShow = this.onBlockedUsersShow.bind(this); this.onBlockedUsersHide = this.onBlockedUsersHide.bind(this); - this.onReplyClick = this.onReplyClick.bind(this); this.onSortChange = this.onSortChange.bind(this); this.onUnblockSomeone = this.onUnblockSomeone.bind(this); this.checkUrlHash = this.checkUrlHash.bind(this); @@ -139,14 +138,6 @@ export default class Root extends Component { }); } - onReplyClick(cb) { - if (this.onPrevReplyClickCallback) { - this.onPrevReplyClickCallback(); - } - - this.onPrevReplyClickCallback = cb; - } - onSortChange(sort) { if (sort === this.state.sort) return; @@ -247,7 +238,6 @@ export default class Root extends Component { mods={{ level: 0 }} data={thread} onReply={this.addComment} - onReplyClick={this.onReplyClick} /> )) } diff --git a/web/app/components/thread/thread.jsx b/web/app/components/thread/thread.jsx index 6e947b7d..d6dcad3d 100644 --- a/web/app/components/thread/thread.jsx +++ b/web/app/components/thread/thread.jsx @@ -19,7 +19,7 @@ export default class Thread extends Component { } render(props, { collapsed }) { - const { data: { comment, replies = [] }, mix, mods = {}, onReplyClick } = props; + const { data: { comment, replies = [] }, mix, mods = {} } = props; return (
@@ -27,7 +27,6 @@ export default class Thread extends Component { data={comment} mods={{ level: mods.level, collapsed, collapsible: !!replies.length }} onReply={props.onReply} - onReplyClick={onReplyClick} onCollapseToggle={this.onCollapseToggle} /> @@ -37,7 +36,6 @@ export default class Thread extends Component { data={thread} mods={{ level: mods.level < 5 ? mods.level + 1 : mods.level }} onReply={props.onReply} - onReplyClick={onReplyClick} /> )) }