diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js index d1bff4524..4ae1bbdd6 100644 --- a/app/javascript/mastodon/components/status.js +++ b/app/javascript/mastodon/components/status.js @@ -107,15 +107,12 @@ class Status extends ImmutablePureComponent { state = { showMedia: defaultMediaVisibility(this.props.status), statusId: undefined, + noPreviewData: true, }; // Track height changes we know about to compensate scrolling componentDidMount () { this.didShowCard = !this.props.muted && !this.props.hidden && this.props.status && this.props.status.get('card'); - if(this.props.com_prev) { - const { status } = this.props; - this.props.onPreview(status.get('id')); - } } getSnapshotBeforeUpdate () { @@ -181,6 +178,13 @@ class Status extends ImmutablePureComponent { this.context.router.history.push(`/statuses/${status.getIn(['reblog', 'id'], status.get('id'))}`); } + handleMouseEnter = () => { + if(this.props.com_prev && this.state.noPreviewData) { + const { status } = this.props + this.props.onPreview(status.getIn(['reblog', 'id'], status.get('id'))); + this.setState({noPreviewData: false}); + } + } handleExpandClick = (e) => { if (this.props.onClick) { this.props.onClick(); @@ -477,7 +481,7 @@ class Status extends ImmutablePureComponent {