Git Product home page Git Product logo

Comments (3)

foxbenjaminfox avatar foxbenjaminfox commented on August 30, 2024

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 vue-async-computed, I'll see about adding a setting for this.

from vue-async-computed.

michaelzangl avatar michaelzangl commented on August 30, 2024

Using #45, you could do:

<div v-if="data && !$asyncComputed.data.updating">{{ data }}</div>
<spinner v-else/>

from vue-async-computed.

foxbenjaminfox avatar foxbenjaminfox commented on August 30, 2024

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 vue-async-computed library.

from vue-async-computed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.