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

**URL:** https://meta.discourse.org/t/body-class-from-category-not-loading-on-topics-on-first-load/32463
**Category:** Bug
**Created:** [24 Agosto , 2015 11:47 UTC](https://meta.discourse.org/t/body-class-from-category-not-loading-on-topics-on-first-load/32463 "2015-08-24T11:47:22Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![charleswalter](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/charleswalter/32/116433_2.png) [@charleswalter](https://meta.discourse.org/u/charleswalter)
#### Post date: [24 Agosto , 2015 11:47 UTC](https://meta.discourse.org/t/body-class-from-category-not-loading-on-topics-on-first-load/32463/1 "2015-08-24T11:47:23Z")

</div>

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:  
[http://www.helloforos.com/t/desde-la-noche/5531](http://www.helloforos.com/t/desde-la-noche/5531)

---

<div class="post-metadata">

### Author: ![charleswalter](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/charleswalter/32/116433_2.png) [@charleswalter](https://meta.discourse.org/u/charleswalter)
#### Post date: [24 Agosto , 2015 11:54 UTC](https://meta.discourse.org/t/body-class-from-category-not-loading-on-topics-on-first-load/32463/2 "2015-08-24T11:54:35Z")

</div>

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.  
[http://www.helloforos.com/c/entretenimiento/chismesgordos](http://www.helloforos.com/c/entretenimiento/chismesgordos)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [24 Agosto , 2015 23:14 UTC](https://meta.discourse.org/t/body-class-from-category-not-loading-on-topics-on-first-load/32463/3 "2015-08-24T23:14:42Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [25 Agosto , 2015 15:28 UTC](https://meta.discourse.org/t/body-class-from-category-not-loading-on-topics-on-first-load/32463/4 "2015-08-25T15:28:56Z")

</div>

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

[https://github.com/discourse/discourse/commit/d15b698ac90cfca0a459bdda83e6731a4db8be48](https://github.com/discourse/discourse/commit/d15b698ac90cfca0a459bdda83e6731a4db8be48)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [25 Agosto , 2015 15:28 UTC](https://meta.discourse.org/t/body-class-from-category-not-loading-on-topics-on-first-load/32463/5 "2015-08-25T15:28:58Z")

</div>



---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [26 Agosto , 2015 18:00 UTC](https://meta.discourse.org/t/body-class-from-category-not-loading-on-topics-on-first-load/32463/6 "2015-08-26T18:00:15Z")

</div>

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 🍰)

[https://github.com/discourse/discourse/commit/31f0300b06304b056e700d6c097928b8e90763c0](https://github.com/discourse/discourse/commit/31f0300b06304b056e700d6c097928b8e90763c0)
