-
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
Fix: changeset.set('prop', undefined); does not update prop #191
Conversation
456e277
to
1732e0e
Compare
addon/index.js
Outdated
@@ -494,7 +494,7 @@ export function changeset(obj, validateFn = defaultValidatorFn, validationMap = | |||
this._deleteKey(ERRORS, key); | |||
|
|||
if (!isEqual(oldValue, value)) { | |||
set(changes, key, value); | |||
changes[key] = 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.
I'm not quite sure why Ember.set
fails to update value. I think changing property directly might be okay since we call this.notifyPropertyChange(CHANGES);
later.
+1 |
@jelhan Is this still a problem for ya? We could put in a fix today (sry it's been so long) |
Don't have the time today. I think we should check if this scenario is already tested in master. If not, we could apply the test in this PR. If it fails, we might use the fix provided by this PR. Will try to do it over the weekend. |
1732e0e
to
c7ca79d
Compare
Current code base is using provided patch. After a lot of refactoring the code line now lives at: https://github.com/poteto/ember-changeset/blob/master/addon/utils/set-nested-property.js#L41 After setting a property to Simple reproduction:
This PR now provides additional tests to cover both. Test for |
Reported the issue regarding |
I have an
In both cases, I'm using |
@algodave You could try using this pull request for ember-deep-set. You could do so by selective dependency resolutions feature of yarn. The pull request should fix this issue. Please report your findings here. |
Thanks @jelhan will do! |
@jelhan Looks like a minor merge conflict here. ember-deep-set 0.1.4 was published fyi! |
c7ca79d
to
1d21e96
Compare
Fixed merge conflicts, which were introduced by my own PR. 😆 Also updated ember-deep-set@0.1.4. Don't get confused by travis passing even without that update. It uses |
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.
Awesome work! Love it 💯
changeset.set('prop', undefined)
does not change value.Please not that #190 is needed to fix this if
skipValidate
istrue
. Since without #190oldValue
is alwaysundefined
, conditionisEqual(oldValue, value)
will always betrue
ifvalue
isundefined
and therefore change will not be executed.