Reputation: 138
Lets say I have a oneWay
CP which is initially bound to a model property (and is hence free to diverge if updated)
The CP can be set to values fixed
& dynamic
. I have some equal
CPs which in turn rely on this oneWayCp
changing
oneWayCp: oneWay('model.field')
isFixed: equal('oneWayCp', 'fixed').volatile().readOnly(),
isDynamic: equal('oneWayCp', 'dynamic').volatile().readOnly(),
I'm seeing a weird bug wherein isFixed
& isDynamic
don't update when oneWayCp
is updated
Is this expected behavior ?
Upvotes: 1
Views: 49
Reputation: 18240
Actually your problem is .volatile()
. Basically this disables the update on dependency keys behaviour.
Here is a fixed twiddle.
So you should do this:
oneWayCp: oneWay('model.field')
isFixed: equal('oneWayCp', 'fixed').readOnly(),
isDynamic: equal('oneWayCp', 'dynamic').readOnly(),
Refer to the documentation:
It also does not automatically fire any change events. You must manually notify any changes if you want to observe this property.
Upvotes: 3