# Tracked variable not found?

**URL:** https://meta.discourse.org/t/tracked-variable-not-found/370793
**Category:** Development
**Created:** [June 19, 2025, 5:06am UTC](https://meta.discourse.org/t/tracked-variable-not-found/370793 "2025-06-19T05:06:56Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [June 19, 2025, 5:06am UTC](https://meta.discourse.org/t/tracked-variable-not-found/370793/1 "2025-06-19T05:06:56Z")

</div>

This is my code:

```js
import { apiInitializer } from "discourse/lib/api";
import { iconNode } from "discourse-common/lib/icon-library";
import { tracked } from "@glimmer/tracking";

export default apiInitializer((api) => {
  @tracked iconName = settings.category_lock_icon || 'lock'; // Fallback to 'lock' if setting is not defined
  @tracked lockIcon = iconNode(this.iconName);

```

Frustratingly, the browser console tells me that `ReferenceError: iconName is not defined`. Looking at the file in the browser dev tools, this is what it looks like:

```js
iconName = settings.category_lock_icon || 'lock'; // Fallback to 'lock' if setting is not defined
lockIcon = (0, _iconLibrary.iconNode)((void 0).iconName);

```

This, compared to another component I made that uses tracked variables (which works):

```js
#buttonIcon = (() => (dt7948.i(this, "buttonIcon"), void 0))();

```

, where the original code is

```js
@tracked buttonIcon = localStorage.getItem('buttonIcon') != null ? localStorage.getItem('buttonIcon') : "bug";

```

Am I doing something wrong?

---

_[View the full topic](https://meta.discourse.org/t/tracked-variable-not-found/370793)._
