-
-
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
isEmpty
call on ProxyObject w/ size
property throws '.get()' proxy assertion (3.1+)
#17032
Comments
isEmpty
call on changeset w/ size
property throws '.get()' proxy assertionisEmpty
call on changeset w/ size
property throws '.get()' proxy assertion (3.1+)
@nickschot can you create an ember-twiddle as an example? |
@pixelhandler I did some more debugging and the test case is pretty simple. I will update the main post with my new findings. Meanwhile a reproduction can be found: https://ember-twiddle.com/d3b2742a7156454f2ece80d6c26d2581?openFiles=controllers.application.js%2C . Press the "validate" button once and the error is thrown in the console. |
isEmpty
call on changeset w/ size
property throws '.get()' proxy assertion (3.1+)isEmpty
call on ProxyObject w/ size
property throws '.get()' proxy assertion (3.1+)
I have created an updated test case which doesn't use changeset but a normal ObjectProxy in the example (as this is the more general case). Updated minimal reproduction: https://ember-twiddle.com/8e63470aa2e8ab8b07735334b169c96d?openFiles=controllers.application.js%2C The first post is also updated. |
I think the solution can be as simple as adding an
Proposed fix:
This uses the same check as the assertion:
|
The same is true for an ObjectProxy with a property |
Having an ObjectProxy (or any object using unknownProperty) with a property named 'size' of type String
isEmpty(myChangeset)
results in theAssertion Failed: You attempted to access the 'size' property (of changeset:[object Object]). Since Ember 3.1 , this is usually fine as you no longer need to use '.get()'...
error.This is caused at:
ember.js/packages/@ember/-internals/metal/lib/is_empty.ts
Line 44 in f73d844
Minimal reproduction: https://ember-twiddle.com/8e63470aa2e8ab8b07735334b169c96d?openFiles=controllers.application.js%2C
AFAIK
.size
is just used for Maps/Sets and the like? Might an extra check be necessary?Somewhat similar to: #16259
cc @snewcomer
The text was updated successfully, but these errors were encountered: