Tag Counts Missing on Tags Page

I tried to debug the issue. Here is what I figured out.

I found the site on another topic and checked it without plugins/themes, but the issue still happens.

What is odd is the count in the API.

Looking at the source code:

discourse/app/assets/javascripts/discourse/app/templates/components/tag-list.hbs at v3.0.6 · discourse/discourse · GitHub
image

I tried to debug to see, and the count is well passed. It is; no problem here.

However, we can see the pmCount is undefined. This is likely the issue because the totalCount has a NaN (Not A Number) value now, which is why the condition in the template is ignoring it.

image

Looking at the GIT history, this function has been fixed in this PR where you can see pmCount is being checked before adding the two numbers.
SECURITY: Hide PM count for tags by default (#20061) · discourse/discourse@f31f0b7 · GitHub
image

This fix is available since 3.1.0.
Searching your Discourse version gives me you’re using an old stable version 3.0.6

image

Short version:

You’re using Discourse 3.0.6, and a fix landed in 3.1.0, which fixed indirectly this issue. :thinking:
You can probably fix your issue by updating to the latest stable version, which is 3.2.0 or, at the very least, 3.1.0.

2 Likes