summaryrefslogtreecommitdiffstats
path: root/web/react/components/post_body_additional_content.jsx
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2016-02-23 16:45:43 -0500
committerhmhealey <harrisonmhealey@gmail.com>2016-02-23 17:01:25 -0500
commit1dbe949ce8f65f1110e0f43797bd757bfa906ee0 (patch)
tree57e5b8470cde687d32d17ce4c24f534ba0f5e09a /web/react/components/post_body_additional_content.jsx
parentb2e333e83cf3a9693744fa2baab937bb3ac8be28 (diff)
downloadchat-1dbe949ce8f65f1110e0f43797bd757bfa906ee0.tar.gz
chat-1dbe949ce8f65f1110e0f43797bd757bfa906ee0.tar.bz2
chat-1dbe949ce8f65f1110e0f43797bd757bfa906ee0.zip
Removed unnecessary state from PostBodyAdditionalContent
Diffstat (limited to 'web/react/components/post_body_additional_content.jsx')
-rw-r--r--web/react/components/post_body_additional_content.jsx26
1 files changed, 3 insertions, 23 deletions
diff --git a/web/react/components/post_body_additional_content.jsx b/web/react/components/post_body_additional_content.jsx
index c0a52dc92..a76c59fb3 100644
--- a/web/react/components/post_body_additional_content.jsx
+++ b/web/react/components/post_body_additional_content.jsx
@@ -16,30 +16,10 @@ export default class PostBodyAdditionalContent extends React.Component {
this.getSlackAttachment = this.getSlackAttachment.bind(this);
this.getOEmbedProvider = this.getOEmbedProvider.bind(this);
-
- this.state = {
- link: Utils.extractLinks(props.post.message)[0]
- };
}
- componentWillReceiveProps(nextProps) {
- if (this.props.post.message !== nextProps.post.message) {
- this.setState({
- link: Utils.extractLinks(nextProps.post.message)[0]
- });
- }
- }
-
- shouldComponentUpdate(nextProps, nextState) {
- if (nextState.link !== this.state.link) {
- return true;
- }
-
- if (nextProps.post.type !== this.props.post.type) {
- return true;
- }
-
- if (!Utils.areObjectsEqual(nextProps.post.props, this.props.post.props)) {
+ shouldComponentUpdate(nextProps) {
+ if (!Utils.areObjectsEqual(nextProps.post, this.props.post)) {
return true;
}
@@ -76,7 +56,7 @@ export default class PostBodyAdditionalContent extends React.Component {
return this.getSlackAttachment();
}
- const link = this.state.link;
+ const link = Utils.extractLinks(this.props.post.message)[0];
if (!link) {
return null;
}