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.

asyncComputed is not lazy like computed

See original GitHub issue

Not sure if this should be a default but, I think, there should be option to make asyncComputed lazy like vue computed. Right now even if you use v-if to not render computed data it is still being retrieved.

#247 - Example of failing test

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Demivancommented, Dec 14, 2020

Sure, I’ll work on it.

1reaction
antfucommented, Dec 14, 2020

The behaviour has already described as a caveat in the doc. I am not sure if it makes sense to have asyncComputed lazy as in that way you will always get the null on the first access (and need to wait for the promise get resolved from that time).

Re: invalidableComputed

With https://github.com/vuejs/rfcs/pull/212 (likely in Vue 3.1), it will expose effect to vue and we can make invalidableComputed easily with it. However, that would be a Vue 3 only thing (Vue 2 does not have effect).

Read more comments on GitHub >

github_iconTop Results From Across the Web

$asyncComputed is undefined in computed property · Issue #56
I wanted to use $asyncComputed.posts.error in a computed property, but it's undefined and non-reactive. Is there a way to accomplish that?
Read more >
asyncComputed - VueUse
Just like Vue's built-in computed function, useAsyncComputed does dependency tracking and is automatically re-evaluated when dependencies change. Note however ...
Read more >
VueJS: Is it suitable to trigger async function inside computed ...
Yes, it's best to avoid an async call in a computed property. What I have done in similar situations is have a computed...
Read more >
How to create and use async properties - Hacking with Swift
Just as Swift's functions can be asynchronous, computed properties can also be asynchronous: attempting to access them must also use await ...
Read more >
Top Vue Packages for Adding Async Computed Properties ...
In our example, we just take the product of them and set that as the… ... However, with the addition of the vue-async-computed...
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