diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-10-23 08:01:51 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-10-23 08:03:32 -0400 |
commit | 4c0e4991e76c18fd39ffadcf5b0e1943fb4cd2c3 (patch) | |
tree | 5adc38250ba86d184ad0888b222d725951910a75 /web | |
parent | d4f1f981a5143663e03a1daab8105cc11b39820d (diff) | |
download | chat-4c0e4991e76c18fd39ffadcf5b0e1943fb4cd2c3.tar.gz chat-4c0e4991e76c18fd39ffadcf5b0e1943fb4cd2c3.tar.bz2 chat-4c0e4991e76c18fd39ffadcf5b0e1943fb4cd2c3.zip |
Make sure gif only loads once
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/post_body.jsx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx index 6b15682b0..45eae8c6a 100644 --- a/web/react/components/post_body.jsx +++ b/web/react/components/post_body.jsx @@ -13,6 +13,7 @@ export default class PostBody extends React.Component { super(props); this.receivedYoutubeData = false; + this.isGifLoading = false; this.parseEmojis = this.parseEmojis.bind(this); this.createEmbed = this.createEmbed.bind(this); @@ -70,6 +71,12 @@ export default class PostBody extends React.Component { } loadGif(src) { + if (this.isGifLoading) { + return; + } + + this.isGifLoading = true; + const gif = new Image(); gif.src = src; gif.onload = ( |