GithubHelp home page GithubHelp logo

Comments (3)

dgeb avatar dgeb commented on June 10, 2024

This is definitely intentional. find is asynchronous and returns a static record array. all is synchronous and returns a live record array. This allows for maximum flexibility and control.

When combined, you can return a live record array only after find completes. For instance: return store.find('type').then(function() { return store.all('type'); });. It's also valid to just return the result from find if you want to capture all the records of a type at a particular moment in time. If find always returned all, then this distinction wouldn't be possible. Another valid use case is to bind a collection to the all live array - you don't need to immediately trigger the async find to do so.

I'm not saying that I'm opposed to adding convenience methods (findAll perhaps?) that merge functionality, but I want to keep the distinction as well.

This section of the README clarifies which methods are synchronous and which are asynchronous. All the synchronous methods provide immediate access to a store's current contents, while all the asynchronous methods flow through Orbit's requestable interface.

from ember-orbit.

opsb avatar opsb commented on June 10, 2024

That does seem reasonable. I suspect I would use findAll far more often than all so yes that would be a nice addition. I'm working on a firebase Source at the moment but I'd be happy to put a PR together once I've got that out the way.

from ember-orbit.

dgeb avatar dgeb commented on June 10, 2024

You can now query a store (store.query) to engage with an Orbit Coordinator and remote sources (if configured). Or you can query a store's cache (store.cache.query) to only get results presently in memory.

from ember-orbit.

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.