Coder Social home page Coder Social logo

Comments (3)

hongaar avatar hongaar commented on May 26, 2024

I don't know much about ember-orbit, can you tell me more about your intended use case?

from react-orbitjs.

YuriScarbaci avatar YuriScarbaci commented on May 26, 2024

I don't know much about ember-orbit, can you tell me more about your intended use case?

Sure:

I got a component that uses withData and among other things it retrieves multiple instances of the model (let's say) user, the user model defines a hasOne relationship with the model (let's say) BestFriend

I generate a table of user where I want to print every retrieved User and in the same table i want to print 2 columns of the single User BestFriend.attributes.name & BestFriend.attributes.surname

Logging every single user istance results in the relationship BestFriend to be present and working (meaning that it contains type & id) but I noticed the lack of helpers methods to acces the related data attributes.

What i would like to be able to do is invoking a getter function on the User instance where i define the relationship defined in my schema to populate the relationships fields.

Something like currentUserInstance.get('BestFriend').attributes.name.

The only way to achieve this right now (atleast in the indexedDb source) is to manually invoke queryStore(q=>q.findRecord({type:'type from the relationship descriptor',id:'id from relationship descriptor'})) manually on every single user instance, would be extra nice if the get method could syntactical sugar coat the process...

from react-orbitjs.

hongaar avatar hongaar commented on May 26, 2024

Got it.

It's however not really the goal for this project to provide a model/orm layer on top of Orbit, merely a reactive subscription/listener pattern to bind React and Orbit together.

Maybe https://github.com/exivity/orbit-client might be a better place for such functionality.
/cc @Michiel87

from react-orbitjs.

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.