question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

class get cache issue

See original GitHub issue

copied 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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
John0Kingcommented, May 11, 2020

@ktsn if Getters / setters are converted to computed properties then it should use the cache: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 call this.<property> , and for vue object style, they called computed properties not geter/seter.

I suggest:

  1. the default get/set convert to computed properties with option cache:false
  2. add @Computed(options: { cache?:boolean }) and allow configurate with the get or set method (configurate only need once eg. only add on getter or setter , like angular does)
3reactions
ktsncommented, May 12, 2020

It’s undocumented / private api and we recommend against using it.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found