# Adding pluginId to modifyClass when a mixin is used

**URL:** https://meta.discourse.org/t/adding-pluginid-to-modifyclass-when-a-mixin-is-used/226148
**Category:** Development
**Created:** [May 4, 2022, 5:56pm UTC](https://meta.discourse.org/t/adding-pluginid-to-modifyclass-when-a-mixin-is-used/226148 "2022-05-04T17:56:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![keegan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/keegan/32/383395_2.png) [@keegan](https://meta.discourse.org/u/keegan)
#### Post date: [May 4, 2022, 5:56pm UTC](https://meta.discourse.org/t/adding-pluginid-to-modifyclass-when-a-mixin-is-used/226148/1 "2022-05-04T17:56:26Z")

</div>

I am trying to squash the warning:

```plaintext
[PLUGIN discourse-layouts] To prevent errors in tests, add a `pluginId` key to your `modifyClass` call. This will ensure the modification is only applied once.

```

However, in the case of the Layouts plugin, there is a Mixin called Sidebars being passed in to the `api.modifyClass()` method like so:

`api.modifyClass(controllerClass, Sidebars)` [(See code)](https://github.com/paviliondev/discourse-layouts/blob/020d305aff7defac07a749da2c0e5dbe92fc7faf/assets/javascripts/discourse/lib/layouts.js.es6#L224)

I’ve tried many things, including adding the pluginId to a property on the Mixin:

```js
export default Mixin.create({
  pluginId: 'discourse-layouts',
  router: service(),
  path: alias("router._router.currentPath"),
...

```

However the warning continues to appear.

The only way I was able to suppress the warning was by using this code instead of modifyClass()

```js
 const klass = api._resolveClass(controllerClass, {});
 klass.class.reopen(Sidebars);

```

However, I don’t feel its the best approach because I’m essentially skipping the check that helps prevent modifyClass from being applied over and over.

**Does anybody have any advice or thoughts on how I can add the pluginId to api.modifyClass() when a mixin is used and successfully supress that warning?**
