changeset.set('name', 'Jim Bob');
changeset.set('address.country', 'United States');
changeset.set('unwantedProp', 'foo');
changeset.set('address.unwantedProp', 123);
changeset.get('name // Jim Bob
changeset.get('address.country // United States
changeset.get('unwantedProp')); // foo
changeset.get('address.unwantedProp // 123
>>>> changeset.cast([name,address.country])
changeset.get('name // Jim Bob
changeset.get('address.country // United States
changeset.get('unwantedProp')); // undefined
changeset.get('another.unwantedProp // undefined
Actual Behavior
Logging changeset.get('address.country') aftercastis not undefined, where it should beUnited States. Note that beforecastit logs asUnited States. Note also that the same issue does not occur forname`.
changeset.set('name', 'Jim Bob');
changeset.set('address.country', 'United States');
changeset.set('unwantedProp', 'foo');
changeset.set('address.unwantedProp', 123);
changeset.get('name // Jim Bob
changeset.get('address.country // United States
changeset.get('unwantedProp')); // foo
changeset.get('address.unwantedProp // 123
>>>> changeset.cast([name,address.country])
changeset.get('name // Jim Bob
changeset.get('address.country // undefined
changeset.get('unwantedProp')); // undefined
changeset.get('another.unwantedProp // undefined
Version
ember-changeset 4.1.1 ember-source 3.28
Test Case
Reduced test case here
Steps to reproduce
If running the app in the reduced test case above, simply click the button "Test" on the landing page of the above app and look at the console output.
Doing so runs this action, closely based on the docs for
cast
, so you could also just copy and paste this code into a component.Expected Behavior
Logging
changeset.get('address.country') after
castshould be
United States`.Actual Behavior
Logging
changeset.get('address.country') after
castis not undefined, where it should be
United States. Note that before
castit logs as
United States. Note also that the same issue does not occur for
name`.