# api.modifyClass sometimes(!) not working

**URL:** <https://meta.discourse.org/t/api-modifyclass-sometimes-not-working/212413>\
**Category:** Bug\
**Created:** [December 17, 2021, 7:54am UTC](https://meta.discourse.org/t/api-modifyclass-sometimes-not-working/212413 "2021-12-17T07:54:25Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [December 17, 2021, 7:54am UTC](https://meta.discourse.org/t/api-modifyclass-sometimes-not-working/212413/1 "2021-12-17T07:54:25Z")

</div>

Edit: reclassified as bug.  
Full repro [below](https://meta.discourse.org/t/help-needed-api-modifyclass-sometimes-not-working/212413/12).

I’m using `api.modifyClass` in a theme component.

On most pages this is working fine, but in some topics the property is not added to the user model when the page is reloaded. I cannot find why it is working on most topics, but not working on some, or what the topics where it is not working have in common.

~~Does anyone understand what I am doing wrong here?~~

TL;DR Adding `api.container.lookup` for the model, below the modifyClass, works around this issue.

---

_[View the full topic](https://meta.discourse.org/t/api-modifyclass-sometimes-not-working/212413)._
