From e123476329fe3f7515e38dd0260630370e606d9a Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Wed, 30 Jun 2021 08:30:16 +0300 Subject: [PATCH] FIX: Always render topic counts (#13563) A post is rendered multiple times when it is being loaded. Sometimes, not all information is available and the best link in the Onebox cannot be found. --- app/assets/javascripts/discourse/app/widgets/post-cooked.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/widgets/post-cooked.js b/app/assets/javascripts/discourse/app/widgets/post-cooked.js index eb870d31c85..35c65f91220 100644 --- a/app/assets/javascripts/discourse/app/widgets/post-cooked.js +++ b/app/assets/javascripts/discourse/app/widgets/post-cooked.js @@ -142,7 +142,8 @@ export default class PostCooked { const $onebox = $link.closest(".onebox"); if ( $onebox.length === 0 || - (bestElements[$onebox[0]] && bestElements[$onebox[0]] === $link[0]) + !bestElements[$onebox[0]] || + bestElements[$onebox[0]] === $link[0] ) { const title = I18n.t("topic_map.clicks", { count: lc.clicks }); $link.append(