From 81f1aaf298793e0d58264a2b12c221733a74796b Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 18 Feb 2020 09:00:17 -0500 Subject: [PATCH] Fix iframely always refetching bug. --- ui/src/components/post-listing.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx index 7b3d6479..50e1f30c 100644 --- a/ui/src/components/post-listing.tsx +++ b/ui/src/components/post-listing.tsx @@ -101,11 +101,14 @@ export class PostListing extends Component { 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);