You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In your code the "final" target[prop] (not the parent) is assigned a {} which after call to result is reset to the passed value. Normally no one would notice this double assignment except of course if you happen to be observing that assignment via a setter and a subscription.
it looks like this in my observer subscription handler an throws errors down th e line in my code cause it was expecting a primitive value not {}.
observed set value { value: {}, path: 'some.thing' }
observed set value { value: 'value that was to be set', path: 'some.thing' }
So I simply flopped the order
if(i===len-1){result(target,prop,value,merge)break}if(!isObject(target[prop]&&len)){console.log('not object, set empty')target[prop]={}}
and voila no assignment to {} first. Just the one firing of my observer.
Doesn't seem like this would cause any other issue in doing this and will eliminate an unnecessary conditional and assignment.
I'll fork, make this change, run your tests and submit pr.
also kinda wondering if if (merge && isPlain(target[path]) && isPlain(value)) {
might not work as intended if isPlain doesn't resolve the setter to see if it contains a plain object or not. (i.e it thinks it's not cause it's a setter)
The text was updated successfully, but these errors were encountered:
Took me awhile to track this down to your package :).
I am using set-value to set a setter that's calling a rxjs next like so.
In your code the "final" target[prop] (not the parent) is assigned a {} which after call to result is reset to the passed value. Normally no one would notice this double assignment except of course if you happen to be observing that assignment via a setter and a subscription.
it looks like this in my observer subscription handler an throws errors down th e line in my code cause it was expecting a primitive value not {}.
So I simply flopped the order
and voila no assignment to {} first. Just the one firing of my observer.
Doesn't seem like this would cause any other issue in doing this and will eliminate an unnecessary conditional and assignment.
I'll fork, make this change, run your tests and submit pr.
also kinda wondering if
if (merge && isPlain(target[path]) && isPlain(value)) {
might not work as intended if isPlain doesn't resolve the setter to see if it contains a plain object or not. (i.e it thinks it's not cause it's a setter)
The text was updated successfully, but these errors were encountered: