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

ObjectProxy usage of .get('id') should not be updated #33

Open
rajveerappan opened this issue Jul 16, 2020 · 0 comments
Open

ObjectProxy usage of .get('id') should not be updated #33

rajveerappan opened this issue Jul 16, 2020 · 0 comments

Comments

@rajveerappan
Copy link

Example:

import ObjectProxy from '@ember/object/proxy';
import { computed } from '@ember/object';

export default ObjectProxy.extend({
  isSelection: computed('id', 'selectionId', function () {
    return this.get('id') === this.selectionId;
  }),
});

Actual:
Running this codemod updates usages of this.get('id') to this.id. However, in the case of an ObjectProxy it is still expected that access happens via this.get('id').

Changing to this.id throws the following error:

            Uncaught Error: Assertion Failed: You attempted to access the `id` property (of <(unknown):ember1010>).
            Since Ember 3.1, this is usually fine as you no longer need to use `.get()`
            to access computed properties. However, in this case, the object in question
            is a special kind of Ember object (a proxy). Therefore, it is still necessary
            to use `.get('id')` in this case.
            
            If you encountered this error because of third-party code that you don't control,
            there is more information at https://github.com/emberjs/ember.js/issues/16148, and
            you can help us improve this error message by telling us more about what happened in
            this situation.

Expected:
Usages of this.get('id') within an ObjectProxy are ignored.

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

No branches or pull requests

1 participant