Quantcast
Viewing all articles
Browse latest Browse all 4827

Computed Properties and cache invalidation - When to add cache invalidation key

@Scott_Newcomer wrote:

Let’s say you have a simple computed property (for example && discussion purposes) -

showBio: computed('hasArtwork', 'jobTitle', function() {
  if (this.hasArtwork) {
    return true;
  }
  return this.jobTitle ? true : false;
});

vs

showBio: computed(function() {
  if (this.hasArtwork) {
    return true;
  }
  return this.jobTitle ? true : false;
});

I’ve been a part of the camp where I only add the cache invalidation keys when I can test and prove that it is needed to add cache invalidation keys. However, I’ve also seen where ppl prefer to add any property inside the computed to the cache invalidation keys with or without understanding if it is actually needed.

I’m curious as to what other people’s views on this are - scalpel approach vs splat approach to adding cache invalidation keys.

Posts: 8

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles