-
-
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
Make "calling set on destroyed object" error more descriptive #12998
Make "calling set on destroyed object" error more descriptive #12998
Conversation
There's a check here for |
@@ -103,7 +103,7 @@ testBoth('observer should not fire after being destroyed', function(get, set) { | |||
|
|||
expectAssertion(function() { | |||
set(obj, 'bar', 'BAZ'); | |||
}, 'calling set on destroyed object'); | |||
}, 'calling set on destroyed object: <(unknown mixin):ember405>.bar = BAZ'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I'm not 100% sure this is okay to specify the ember id
3c953e9
to
eeffd0e
Compare
@@ -55,7 +55,8 @@ export function set(obj, keyName, value, tolerant) { | |||
return setPath(obj, keyName, value, tolerant); | |||
} | |||
|
|||
assert('calling set on destroyed object', !obj.isDestroyed); | |||
assert(`calling set on destroyed object: ${obj.constructor ? obj : null}.${keyName} = ${value}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does a .toString
check satisfy the same edge cases with EmptyObject that this obj.constructor
check does? If so, I'd rather use it to make it clearer what we need.
${obj.toString ? obj.toString() : ''}
or something?
Just had one tiny clarification, but I'm 👍 on this... |
Actual code is from PR emberjs#12264, I just added a test :) Closes emberjs#10865
eeffd0e
to
3a2486e
Compare
Yes that totally works! 🎉 Thank you! |
LGTM |
…oyed-object Make "calling set on destroyed object" error more descriptive
Thanks @duggiefresh! |
Apologies for my unclear commit comments. Here's what I'm seeing: This PR introduces a regression where calling |
How is this happening? EmptyObject is not public so it sounds like a framework bug. |
I am seeing this triggered from Ember Data. An AdapterPopulatedRecordArray is setting a metadata object on itself, but the metadata object is an |
FYI I have a branch that adds a utils method to handle |
It's this line in Ember Data 2.3.1 -- the store initializes its metadata objects to |
@bendemboski Thanks. That usage seems reasonable. |
I'll PR a fix shortly. |
Actual code is from PR #12264, I just added a test :)
Closes #10865