From 9a654d7b274422789e5d73898244964db7083e9d Mon Sep 17 00:00:00 2001
From: Saturnino Abril <saturnino.abril@gmail.com>
Date: Thu, 13 Jul 2017 08:47:08 +0900
Subject: prevent image preview to default view when adding/removing reaction
 (#6910)

---
 webapp/components/post_view/post_body_additional_content.jsx | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'webapp/components/post_view/post_body_additional_content.jsx')

diff --git a/webapp/components/post_view/post_body_additional_content.jsx b/webapp/components/post_view/post_body_additional_content.jsx
index 2782c346f..768b999d0 100644
--- a/webapp/components/post_view/post_body_additional_content.jsx
+++ b/webapp/components/post_view/post_body_additional_content.jsx
@@ -55,10 +55,12 @@ 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() {
-- 
cgit v1.2.3-1-g7c22

