From: Dessalines Date: Tue, 3 Mar 2020 16:07:07 +0000 (-0500) Subject: Change action sizes. Add better tippy updating. X-Git-Url: http://these/git/%22https:/nerdica.net/%7Biframely.url%7D?a=commitdiff_plain;h=48594537c038e7c57e232d8de0daa25c7007d44c;p=lemmy.git Change action sizes. Add better tippy updating. --- diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx index 3db87aa5..4d95073c 100644 --- a/ui/src/components/comment-node.tsx +++ b/ui/src/components/comment-node.tsx @@ -103,8 +103,16 @@ export class CommentNode extends Component { this.handleCommentDownvote = this.handleCommentDownvote.bind(this); } - componentDidUpdate() { - setupTippy(); + componentDidUpdate(prevProps: CommentNodeProps) { + let prevComment = prevProps.node.comment; + let comment = this.props.node.comment; + if ( + prevComment.saved !== comment.saved || + prevComment.deleted !== comment.deleted || + prevComment.read !== comment.read + ) { + setupTippy(); + } } componentWillReceiveProps(nextProps: CommentNodeProps) { @@ -256,7 +264,7 @@ export class CommentNode extends Component { dangerouslySetInnerHTML={mdToHtml(this.commentUnlessRemoved)} /> )} -
    +
      {this.props.markable && (
    • { handleShowAdvanced(i: CommentNode) { i.state.showAdvanced = !i.state.showAdvanced; i.setState(i.state); + setupTippy(); } } diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx index 6e285ee9..97d319d8 100644 --- a/ui/src/components/post-listing.tsx +++ b/ui/src/components/post-listing.tsx @@ -102,8 +102,17 @@ export class PostListing extends Component { } } - componentDidUpdate() { - setupTippy(); + componentDidUpdate(prevProps: PostListingProps) { + let prevPost = prevProps.post; + let post = this.props.post; + if ( + prevPost.saved !== post.saved || + prevPost.deleted !== post.deleted || + prevPost.locked !== post.locked || + prevPost.stickied !== post.stickied + ) { + setupTippy(); + } } componentWillReceiveProps(nextProps: PostListingProps) { @@ -492,7 +501,7 @@ export class PostListing extends Component { )}
    -
      +
        {UserService.Instance.user && ( <> {this.props.showBody && ( @@ -1305,5 +1314,6 @@ export class PostListing extends Component { handleShowAdvanced(i: PostListing) { i.state.showAdvanced = !i.state.showAdvanced; i.setState(i.state); + setupTippy(); } }