summaryrefslogtreecommitdiffstats
path: root/webapp/components/post_view/post_body_additional_content.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/post_view/post_body_additional_content.jsx')
-rw-r--r--webapp/components/post_view/post_body_additional_content.jsx14
1 files changed, 9 insertions, 5 deletions
diff --git a/webapp/components/post_view/post_body_additional_content.jsx b/webapp/components/post_view/post_body_additional_content.jsx
index 485e63967..be9e37827 100644
--- a/webapp/components/post_view/post_body_additional_content.jsx
+++ b/webapp/components/post_view/post_body_additional_content.jsx
@@ -55,14 +55,18 @@ export default class PostBodyAdditionalContent extends React.PureComponent {
}
componentWillReceiveProps(nextProps) {
- this.setState({
- embedVisible: nextProps.previewCollapsed.startsWith('false'),
- link: Utils.extractFirstLink(nextProps.post.message)
- });
+ if (nextProps.previewCollapsed !== this.props.previewCollapsed || nextProps.post.message !== this.props.post.message) {
+ this.setState({
+ embedVisible: nextProps.previewCollapsed.startsWith('false'),
+ link: Utils.extractFirstLink(nextProps.post.message)
+ });
+ }
}
toggleEmbedVisibility() {
- this.setState({embedVisible: !this.state.embedVisible});
+ this.setState((prevState) => {
+ return {embedVisible: !prevState.embedVisible};
+ });
}
getSlackAttachment() {