class get cache issue
See original GitHub issuecopied from https://github.com/kaorun343/vue-property-decorator/issues/320.
I do not know which repo should handle this issue, but
the get/set
should not be cached to align with the class
’s behavior
@Component
export default class MyComponent extends Vue{
@Prop({type:Object, default:()=({})})
value!:any;
obj:any = {};
get obj2(){
console.log("get ")// this will only log once,
return {...obj, a: new Date()}
}
@Watch('value',{ deep:true})
watchValue(v:any){
this.obj = {... this.value}
}
mounted(){
this.watchValue(this.value);
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to clear the WebSphere class caches - IBM
There are several reasons for this. After an upgrade, it is possible that the class cache's are still holding onto previous versions of...
Read more >Windows: How to Clear Class App Cache
There are two ways to do this. In App. Click the About link on the top left corner while logged into the Class...
Read more >java - How do I cache Method objects related to a Class if the ...
My first try at a fix was: private final static WeakHashMap<Class<?>, Set<Method>> cache = new HashMap<>();
Read more >Cache - Web APIs | MDN
The Cache interface provides a persistent storage mechanism for Request / Response object pairs that are cached in long lived memory.
Read more >Caching | NestJS - A progressive Node.js framework
The get method on the Cache instance (from the cache-manager package) is used to retrieve items from the cache. If the item does...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ktsn if
Getters / setters are converted to computed properties
then it should use thecache:false
instead of the default cache mode. without cache ,the behavior is match to the class behavior . this is what the class do when you callthis.<property>
, and for vue object style, they called computed properties not geter/seter.I suggest:
cache:false
@Computed(options: { cache?:boolean })
and allow configurate with theget
orset
method (configurate only need once eg. only add ongetter
orsetter
, like angular does)It’s undocumented / private api and we recommend against using it.