Fixed an issue: ko.isWriteableObservable incorrectly returns false for computed observables in the mapping context.
The withProxyDependentObservable function replaces ko.dependentObservable, but does not replace ko.isWriteableObservable, which causes the latter to always return false for computeds. At the same time, the mapping plugin itself uses isWriteableObservable a lot in the mapping process to determine whether it should use the existing observable or replace it with a new, writeable one. Since all computeds look like non-writeable at this point, the mapping procedure will replace all computeds with new observables, thus screwing up the viewmodel inner mechanics.
The solution is simple: when replacing ko.dependentObservable with a proxy, also replace ko.isWriteableObservable.
This doesn't work - you get infinite recursion
Should be var isWriteable = localIWO(o);
instead of
var isWriteable = ko.isWriteableObservable(o);
(inside the ko.isWriteableObservable function)
Indeed.
But this request is so old, and I'm not even sure it's into the right repository anymore.
Is anybody even interested in this?
I've stopped using ko.mapping a long time ago.
It's a shame the mapping seems to have been neglected - it definitely has some issues and I wish it had been maintained - but I'm stuck with using it for now :-)
The reason I needed this change was I'd created a simple writeable observable to auto-convert a string or date to a proper Date object and I wanted it to work with the mapper. Making the change I suggested is working just fine.
Well, glad to be of help. Good luck.