Body class from category not loading on topics on first load?

Is this a bug? or is there a technical limitation for this?

When I first load a topic, we noticed that it does not render the body class from the forum it belongs to, until we do a hard refresh. Has anyone else noticed this?

body class=“docked archetype-regular”

After refresh…
body class=“category-entretenimiento-chismesgordos docked”

Example URL:

Interestingly, this problem appears when accessing topics from a category. When accessing topics from the homepage of the site (categories index, latest posts, etc.), the topic page appears to apply the body class accordingly.

I assume it has to do with the way the web application is rendering the topic pages.

The problem can be seen my visiting this category and clicking on to a topic.

Hmm this might be a bug, @zogstrip can you have a look first thing Europe morning?

1 Like

Thanks for reporting that issue @charleswalter. I just pushed a fix :dolphin:

https://github.com/discourse/discourse/commit/d15b698ac90cfca0a459bdda83e6731a4db8be48

FYI: I had to revert my previous fix as it broke the class on the topics list. Here’s the proper fix (with a memory leak fix :cake:)

https://github.com/discourse/discourse/commit/31f0300b06304b056e700d6c097928b8e90763c0

4 Likes