-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
Accessing Nested Array Without .get() Adds Empty Object to Change Object #624
Comments
Thanks Kyle for the detailed issue! Is there a test you can in this project and reproduces this issue? |
https://github.com/kdagnan/Ember-Changeset-Issue-624 Was also able to confirm a few more things:
All of these are demonstrated in the linked project. You may want to run it & comment things out to see everything I'm talking about. |
I'm facing the same bug. For some reason I missed this GitHub issue when scanning over reported bugs. I came up with another reproduction, which shows the same: https://github.com/jelhan/reproduce-invalid-change-in-ember-changeset-if-used-together-with-ember-bootstrap-power-select To recreate the reproduction yourself, you can follow these steps:
Expected
Actual
P.S.: Please ignore the name of the reproduction repository. I first thought that it might be related to Ember Bootstrap or Ember Power Select. |
I debugged a little bit further. Let me share my findings. Hopefully they are helpful for other to debug further. All findings use my reproduction given above.
Summary
I don't have enough insights if this should be changed in The bug seems to be present in validated-changeset library, which is used by |
I can confirm that I don't see the issue anymore if applying this small change to my reproduction: diff --git a/app/templates/index.hbs b/app/templates/index.hbs
index 39c4ed1..2e99109 100644
--- a/app/templates/index.hbs
+++ b/app/templates/index.hbs
@@ -10,7 +10,7 @@
/>
</div>
<p>
- Author: {{changeset.author.name}}
+ Author: {{changeset-get changeset "author.name"}}
</p>
<button type='submit'>
submit I would still consider this a bug as Enforcing to use That limitation does not seem to be necessary in my case as |
Version
3.13.6
Steps to reproduce
{ name: "Example, address: { residentIds: ["abc123"] } }
const residentIds = changeset.address.residentIds
Expected Behavior
The change {} object and the changes [] array on the changeset should be uneffected:
changeset: { changes: [], change: {} }
Actual Behavior
The change {} object on the changeset has an empty value for the high-level key ("address" in above example), and changes [] array does not reflect it:
changeset: { changes: [], change: { address: {} } }
If you use .get() syntax, this behavior does not occur:
const residentIds = changeset.get('address.residentIds')
The text was updated successfully, but these errors were encountered: