Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX beta] Make modifier manager 3.22 accept the resolved value directly. #19170

Merged
merged 1 commit into from
Sep 30, 2020

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Sep 29, 2020

When using modifierCapabilities('3.13') (the only allowed value in all released Ember versions) you receive the result of owner.factoryFor directly. If you want the raw value, you have to grab it off of the first argument to createModifier like:

class CustomModifierManager {
  capabilities = modifierCapabilities('3.13');

  constructor(owner) {
    this.owner = owner;
  }

  createModifier(factory, args) {
    let Modifier = factory.class;
    return new Modifier(owner, args)
  }

  // ...snip...
}

In order to align the modifier world with the way helpers and component managers work, this commit changes to passing the owner.factoryFor(...).class directly to createModifier instead.

So the above snippet would be rewritten to:

class CustomModifierManager {
  capabilities = modifierCapabilities('3.22');

  constructor(owner) {
    this.owner = owner;
  }

  createModifier(Modifier, args) {
    return new Modifier(owner, args)
  }

  // ...snip...
}

…rectly.

When using `modifierCapabilities('3.13')` (the only allowed value in all
released Ember versions) you receive the result of `owner.factoryFor`
directly. If you want the raw value, you have to grab it off of the
first argument to `createModifier` like:

```js
class CustomModifierManager {
  capabilities = modifierCapabilities('3.13');

  constructor(owner) {
    this.owner = owner;
  }

  createModifier(factory, args) {
    let Modifier = factory.class;
    return new Modifier(owner, args)
  }

  // ...snip...
}
```

In order to align the modifier world with the way helpers and component
managers work, this commit changes to passing the
`owner.factoryFor(...).class` directly to `createModifier` instead.

So the above snippet would be rewritten to:

```js
class CustomModifierManager {
  capabilities = modifierCapabilities('3.22');

  constructor(owner) {
    this.owner = owner;
  }

  createModifier(Modifier, args) {
    return new Modifier(owner, args)
  }

  // ...snip...
}
```
@rwjblue rwjblue requested a review from pzuraq September 29, 2020 23:20
@rwjblue rwjblue merged commit 14bd52f into master Sep 30, 2020
@rwjblue rwjblue deleted the make-modifier-3-22-use-definition branch September 30, 2020 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants