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 release] Fix setDiff computed macro used within glimmer component #18742

Merged
merged 1 commit into from
Feb 18, 2020

Conversation

cloutierlp
Copy link
Contributor

@cloutierlp cloutierlp commented Feb 14, 2020

Using setDiff computed macro within a glimmer component is failing due to this.get being unaccessible within that scope.

Replacing the this.get with the get imported from @ember/-internals/metal just as in every other macros fixes the issue.

As every reduce_computed_macros tests are within the object folder, I didn't really know where to create the new failing test for the current issue, as it seems related to the usage of a glimmer component. If anyone have any idea on how and where we should create a test for this, I'd be interested to know.

To reproduce the issue, create a glimmer component and use the setDiff computed macro:

import Component from '@glimmer/component';
import { setDiff } from '@ember/object/computed';

export default class SetDiffComponent extends Component {
  fruits = [
    'banana',
    'grape',
    'kale'
  ]

  likes = [
    'grape',
    'kale'
  ]

  @setDiff('fruits', 'likes') wants;
}

And then trigger the computation of the wants property. This will be resulting in the following error:

Uncaught (in promise) TypeError: this.get is not a function
    at SetDiffComponent.<anonymous> (reduce_computed_macros.js:1114)
    at index.js:2478
    at untrack (index.js:1018)
    at ComputedProperty.get (index.js:2477)
    at SetDiffComponent.CPGETTER_FUNCTION [as wants] (index.js:638)
    at getPossibleMandatoryProxyValue (index.js:1722)
    at get (index.js:1788)
    at index.js:460
    at runInAutotrackingTransaction (index.js:706)
    at track (index.js:986)

@pzuraq pzuraq merged commit 7e09bb2 into emberjs:master Feb 18, 2020
@pzuraq pzuraq changed the title [BUGFIX beta] Fix setDiff computed macro used within glimmer component [BUGFIX release] Fix setDiff computed macro used within glimmer component Feb 18, 2020
@pzuraq
Copy link
Contributor

pzuraq commented Feb 18, 2020

Thanks for submitting this!

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.

3 participants