-
Notifications
You must be signed in to change notification settings - Fork 66
clear value before updating #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I can see the use case for this. The initial purpose of this library was actually the opposite: to enable you to treat a remote (or otherwise asynchronously computed) property almost as if it were fully synchronous, abstracting away the asynchronous request and making it appear like any other computed property. But I can also see why that's not always what is wanted, and your use case certainly is one that should be easy enough to add support for. So while this isn't really the core purpose of |
Using #45, you could do: <div v-if="data && !$asyncComputed.data.updating">{{ data }}</div>
<spinner v-else/> |
I agree, now that #45 is merged, this gives you a nice and clean way of doing what you want here. This approach will also give you more control of what happens in each separate case: before it's loaded, after it's loaded, while it's updating, or if it had an error. I don't like the idea of blurring the distinction between the first and the third of those automatically, but of course if that's what your use case needs, you certainly should have the tools to be able to easily do that, even if it's not the default behavior of the |
It would be nice (also with a setting-parameter) to clear the value while updating.
like:
so every time,
someProperty
myasyncComputed
-propertydata
gets evaluated, but the spinner component is shown only the first time.there should be a possibility to say, set data to default value every time before the promise gets evaluated
The text was updated successfully, but these errors were encountered: