Closed Ravenex closed 5 years ago
yeah it's a bug, due to your isLazy method in the getter
shorter way to reproduce:
const O = ObjectModel({ _priv: String }).defaults({
getPriv(){
this.randomMethod();
return this._priv
},
randomMethod(){ }
})
const o = new O({ _priv: "test" })
o.getPriv(); // cannot access to private
basically private access is granted for exactly one method call. If there is another method call in the getter, the access pass is exhausted and you get rejected.
Hard to find out but probably easy to fix. Stay tuned
Fixed and released in v3.7.5
Thank you for the report !
Thank you for the extremely fast response.
I am trying to implement lazy loading of properties, or in my case groups of properties, from a database as that group of properties is needed. To accomplish this I want to wrap an object extended from ObjectModel in a outer proxy that can intercept the request for that property and load it before returning it's value. When I do this the object's ability to internally reference it's own private properties breaks. As an example: