Composing/returning of computed inside of computed not possible
Version
3.0.4
Reproduction link
https://jsfiddle.net/tk5ozy8m/
Steps to reproduce
Try to return a computed inside a computed getter (see repro)
What is expected?
Unwrapping of the inner (reactive) computed value inside the template instead of showing some meta attributes.
What is actually happening?
All the inner computed meta values are shown, see reproduction
I'm not sure if this is a bug or a feature request/enhancement (probably something in between).
The repro shows an example how it should work. Where I ran into this issue, the problem is a little bit more complicated and can't be solved with that simple workaround. Apart of that I think computed would be the most elegant solution for such a use case.
It is of course possible to workaround with watch etc. but that kind of feels awkward for the use case in the repro.
Conceptually, returning a computed from a computed doesn't make sense in my book. Architecturally, computed's need to be called synchronously in setup in order to be properly garbage collected later.
Technically, the value should probably be properly unwrapped anyway, but as this is not really a use case concidered for computed
, I'm hesitant to call it a bug.
Agree with @LinusBorg on creating a computed inside of a computed, makes no sense. The resulting behavior makes sense, as the computed ends up returning a computed itself.
However, you are very close to the desired solution, here is (what looks like) what you want: https://jsfiddle.net/tqauc50w/