]> Untitled Git - lemmy.git/commitdiff
Fix iframely always refetching bug.
authorDessalines <tyhou13@gmx.com>
Tue, 18 Feb 2020 14:00:17 +0000 (09:00 -0500)
committerDessalines <tyhou13@gmx.com>
Tue, 18 Feb 2020 14:00:17 +0000 (09:00 -0500)
ui/src/components/post-listing.tsx

index 7b3d6479867ce5dcaf3025118719a0e9a31de80b..50e1f30c9714140e0af3376088e53a25d45edc03 100644 (file)
@@ -101,11 +101,14 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     this.state.upvotes = nextProps.post.upvotes;
     this.state.downvotes = nextProps.post.downvotes;
     this.state.score = nextProps.post.score;
-    this.state.url = nextProps.post.url;
-    this.state.iframely = null;
 
-    if (nextProps.post.url) {
-      this.fetchIframely();
+    if (nextProps.post.url !== this.state.url) {
+      this.state.url = nextProps.post.url;
+      if (this.state.url) {
+        this.fetchIframely();
+      } else {
+        this.state.iframely = null;
+      }
     }
 
     this.setState(this.state);