# \`showOpLikes\` doesn't work right away, but after clicking back and forth

**URL:** https://meta.discourse.org/t/showoplikes-doesnt-work-right-away-but-after-clicking-back-and-forth/143546
**Category:** Support
**Created:** [March 6, 2020, 7:32pm UTC](https://meta.discourse.org/t/showoplikes-doesnt-work-right-away-but-after-clicking-back-and-forth/143546 "2020-03-06T19:32:49Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![negaduck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/negaduck/32/171600_2.png) [@negaduck](https://meta.discourse.org/u/negaduck)
#### Post date: [March 6, 2020, 7:32pm UTC](https://meta.discourse.org/t/showoplikes-doesnt-work-right-away-but-after-clicking-back-and-forth/143546/1 "2020-03-06T19:32:49Z")

</div>

Hello. I’d like to have like counts of original posts on the main page. I followed instuctions from this post: [Display Like Counts on Home Page Topic List - #6 by vinothkannans](https://meta.discourse.org/t/display-like-counts-on-home-page-topic-list/58742/6)

I added the following code with `showOpLikes`, but I have issues with it. Somehow it doesn’t show original post like counts right away. I only does this after click sort by likes and back to latest without sorting.

Interestingly, `showLikes` doesn’t have this issue.

```
<script>
var TopicListComponent = require('discourse/components/topic-list').default;
TopicListComponent.reopen({
    showOpLikes: true
});
</script>

```

* * *

Here is a screenshot before clicking on sort by likes and going to latest:

 ![Screenshot 2020-03-06 at 22.22.01](https://global.discourse-cdn.com/meta/original/3X/9/d/9d2178e67f7e8bcdc440d1bbe15d81f55e3b42e0.png)

* * *

And this is after:

 ![Screenshot 2020-03-06 at 22.22.18](https://global.discourse-cdn.com/meta/original/3X/8/a/8abb5b1d6991730db4a58bcee342004312221e4b.png)

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [March 6, 2020, 8:16pm UTC](https://meta.discourse.org/t/showoplikes-doesnt-work-right-away-but-after-clicking-back-and-forth/143546/2 "2020-03-06T20:16:46Z")

</div>

I believe `showOpLikes` should only work when sorting by OP likes by visiting a URL like `https://meta.discourse.org/latest?order=op_likes`, otherwise the `op_like_count` isn’t included (`showLikes`, should work… but that’s the total for the entire topic).

You can see this in action by viewing `https://meta.discourse.org/latest.json` and `https://meta.discourse.org/latest.json?order=op_likes`… `op_like_count` is only available in that second link.

---

<div class="post-metadata">

### Author: ![negaduck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/negaduck/32/171600_2.png) [@negaduck](https://meta.discourse.org/u/negaduck)
#### Post date: [March 6, 2020, 8:30pm UTC](https://meta.discourse.org/t/showoplikes-doesnt-work-right-away-but-after-clicking-back-and-forth/143546/3 "2020-03-06T20:30:06Z")

</div>

Yeah, but is there any logic behind this, or is it a bug?

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [March 6, 2020, 8:37pm UTC](https://meta.discourse.org/t/showoplikes-doesnt-work-right-away-but-after-clicking-back-and-forth/143546/4 "2020-03-06T20:37:02Z")

</div>

It’s intentionally built that way, but I’m not sure the exact reason. I suspect it’s data we don’t want to carry around on every page load.

We’ve also generally considered the total likes within a topic to be a better measurement of discussion quality than OP alone.

---

<div class="post-metadata">

### Author: ![negaduck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/negaduck/32/171600_2.png) [@negaduck](https://meta.discourse.org/u/negaduck)
#### Post date: [March 6, 2020, 8:52pm UTC](https://meta.discourse.org/t/showoplikes-doesnt-work-right-away-but-after-clicking-back-and-forth/143546/5 "2020-03-06T20:52:07Z")

</div>

Well, it depends on the goals of the community I guess. Our posts represent math questions and problems, so we’d like to see the most liked ones, and I’m not sure including likes given to answers should be considered. Hm. I don’t know.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 7, 2020, 12:11pm UTC](https://meta.discourse.org/t/showoplikes-doesnt-work-right-away-but-after-clicking-back-and-forth/143546/6 "2020-03-07T12:11:40Z")

</div>

I believe that you need to add some javascript to add OP likes to the serializer. If you search “add to serializer” (perhaps without spaces) you should find some examples.

---

<div class="post-metadata">

### Author: ![negaduck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/negaduck/32/171600_2.png) [@negaduck](https://meta.discourse.org/u/negaduck)
#### Post date: [March 7, 2020, 2:15pm UTC](https://meta.discourse.org/t/showoplikes-doesnt-work-right-away-but-after-clicking-back-and-forth/143546/7 "2020-03-07T14:15:08Z")

</div>

Well, I’ve changed it back to just `showLikes`, but thanks for the suggestion, I’ll maybe try this later.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [April 6, 2020, 12:11pm UTC](https://meta.discourse.org/t/showoplikes-doesnt-work-right-away-but-after-clicking-back-and-forth/143546/8 "2020-04-06T12:11:41Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
