-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Special kind of Ember object (a proxy) error thrown in ember 3.1 #16521
Comments
The issue in this case with ember-cli-simple-store (which doesn't seem terribly simple to me 😉 ) is here. In Ember 3.1 doing that check will trigger the reported assertion because the The quick fix workaround is to implement your own init() {
// ...snip...
this.isCopyingMethods = true;
for(let method in model) {
if(typeof model[method] === "function") {
if(!this[method]) {
this.proxyMethod(method);
}
}
}
this.isCopyingMethods = false;
},
unknownProperty() {
if (this.isCopyingMethods) { return; }
return this._super(...arguments);
} To fix this issue generically means either:
|
No problem! Happy to help! |
I recently upgraded an ember addon from ember 3.0 => 3.1 and found a model class that is created via Proxy like so ... (note: RecordProxy is using
ObjectProxy from '@ember/object/proxy'
)And constructed it using a model object with a non computed property (ie: vanilla
function
)Is now throwing an error like so ...
You attempted to access the `change_role` property (of <(unknown mixin):ember244>). 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('change_role')` in this case.
I'm curious if this is a regression or future deprecation just waiting to happen ;)
If I understand the error ... as of ember 3.1 I would need to access this
change_role
function with aEmber.get
... but prior I could invoke it like a normal function (withoutget
) but because it's a function (and not a computed/ or ES5 GETTER) I wouldn't anticipate having to use an explicitEmber.get
to invoke it.I had trouble creating this w/ ember twiddle but I was able to
ember new
using 3.1 to prove it's broken. Note: this app works fine if you were to flip the source dependency back to ember 3.0toranb/simple-store-busted-ember-three-one@427e805
Any helpful pointers on how to move forward here? Thank you in advance!
The text was updated successfully, but these errors were encountered: