4 ms·
Will the getter result be cached? If not, it's not a computed property.
by Timon3 3y ago
Will the getter result be cached? If not, it's not a computed property.
- nitrammm 3y agoAccording to what definition?
- geysersam 3y agoIsn't that just semantics? Whatever name you give the feature "lazily computed and cached values in the context of web frameworks", previously Angular didn't have them (built in) and now they do.
- NoNameProvided 3y agoAngular did have it, it is called RxJS.
- Timon3 3y agoAccording to the "definition" on the Vue documentation page for computed properties: https://vuejs.org/guide/essentials/computed.html#computed-caching-vs-methods https://vuejs.org/guide/essentials/computed.html#computed-ca...
- nitrammm 3y agoThat describe what a computed properly is in the context of Vue.
- Timon3 3y agoAre you aware what comment tree you are in? This whole thing started because GP wrote this: > For example, this update brings us computed properties, an essential feature for any complex performant web application that was made popular by Vue.js 10 years ago [1]. So obviously the relevant definition is "what the feature does in Vue". What is your issue here?
- spyke112 3y agoI’d expect that it’s not cached. But then I would go ahead and call that memoization.
- Timon3 3y agoThe concept is actually slightly different. With memoization you store a map from inputs to outputs. A computed property doesn't necessarily do this, it just caches the result of the last computation. The important part is that a computed property tracks its dependencies and is automatically re-calculated ONLY when necessary. If it behaves differently, it's not equivalent to the concept of a computed property in Vue.