# \`decorateCooked\` should be supplied with an \`id\` option to avoid memory leaks

**URL:** https://meta.discourse.org/t/decoratecooked-should-be-supplied-with-an-id-option-to-avoid-memory-leaks/120301
**Category:** Support
**Created:** [June 13, 2019, 8:40pm UTC](https://meta.discourse.org/t/decoratecooked-should-be-supplied-with-an-id-option-to-avoid-memory-leaks/120301 "2019-06-13T20:40:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![verilog15](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@verilog15](https://meta.discourse.org/u/verilog15)
#### Post date: [June 13, 2019, 8:40pm UTC](https://meta.discourse.org/t/decoratecooked-should-be-supplied-with-an-id-option-to-avoid-memory-leaks/120301/1 "2019-06-13T20:40:12Z")

</div>

For some reason I get the following warning in the DevTools:

![image](https://global.discourse-cdn.com/meta/original/3X/6/c/6c2686ee5e68350bbecb1c8a454542200bf13597.png)

> `decorateCooked` should be supplied with an `id` option to avoid memory leaks.

What could be the issue? How should I solve it?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [June 13, 2019, 9:14pm UTC](https://meta.discourse.org/t/decoratecooked-should-be-supplied-with-an-id-option-to-avoid-memory-leaks/120301/2 "2019-06-13T21:14:53Z")

</div>

In recent versions of Discourse there is a comment about this in the Plugin API code:

````javascript
  /**
   * ```
   * api.decorateCooked(
   * $elem => $elem.css({ backgroundColor: 'yellow' }),
   * { id: 'yellow-decorator' }
   * );
   * ```
   *
   * NOTE: To avoid memory leaks, it is highly recommended to pass a unique `id` parameter.
   * You will receive a warning if you do not.
   **/

````

It looks like all you need to do is pass an `{ id: 'your-id' }` option to the method call.

---

<div class="post-metadata">

### Author: ![verilog15](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@verilog15](https://meta.discourse.org/u/verilog15)
#### Post date: [June 14, 2019, 5:50am UTC](https://meta.discourse.org/t/decoratecooked-should-be-supplied-with-an-id-option-to-avoid-memory-leaks/120301/3 "2019-06-14T05:50:42Z")

</div>

thank you. I’m not sure where to change it though. Tried to grep “decorateCooked” in the theme I use but could not find it. Maybe it’s in the settings? Not sure where it should be.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [June 14, 2019, 6:58am UTC](https://meta.discourse.org/t/decoratecooked-should-be-supplied-with-an-id-option-to-avoid-memory-leaks/120301/4 "2019-06-14T06:58:59Z")

</div>

Sorry, I had assumed this was an issue with a theme you were developing. The deprecation notice seems to be coming from the Discourse code. I think you can ignore it for now.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [June 14, 2019, 9:53am UTC](https://meta.discourse.org/t/decoratecooked-should-be-supplied-with-an-id-option-to-avoid-memory-leaks/120301/5 "2019-06-14T09:53:00Z")

</div>

Yes nothing very bad to worry about. I will make PR to various plugins not providing this ID in the next weeks, it’s just a warning and shouldn’t prevent your site from working correctly.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [June 14, 2019, 9:53am UTC](https://meta.discourse.org/t/decoratecooked-should-be-supplied-with-an-id-option-to-avoid-memory-leaks/120301/6 "2019-06-14T09:53:15Z")

</div>


