Skip to content
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

Manually reload async belongsTo relationship #2380

Closed
jcbvm opened this issue Oct 13, 2014 · 6 comments
Closed

Manually reload async belongsTo relationship #2380

jcbvm opened this issue Oct 13, 2014 · 6 comments

Comments

@jcbvm
Copy link

jcbvm commented Oct 13, 2014

It would be nice to have an option to manually reload a belongsTo relationship the same way we can reload a hasMany relationship (model.get('relationship').reload()).

Currently we'll have to do it this way:

model.get('relationship').then(function(relationship) {
    relationship.reload();
});

The problem with this is that we first have to load it before we can reload it which may cause loading it twice.

(Also reloading it this way does not work when the belongsTo has a link.)

@rhinon
Copy link

rhinon commented Nov 20, 2014

We hit this today as well. Reloading after resolving the relationship does not use the belongsTo link.

@jcbvm
Copy link
Author

jcbvm commented Jan 20, 2015

I still opt for a reloadRelationship function. So instead of calling reload on the relationship itself, we should be able to call reload from it's parent which will take the context of the parent into account. This way, reloading can check for links.

@igorT
Copy link
Member

igorT commented May 25, 2015

We definitely want to support this, here is a RFC that tracks this emberjs/rfcs#57

@jcbvm
Copy link
Author

jcbvm commented May 25, 2015

Thanks, will keep an eye on it!

@pangratz
Copy link
Member

pangratz commented Jan 2, 2016

I think this issue can be closed since an initial implementation of references has been merged into master. Having the ds-references feature enabled, a relationship can be reloaded via model.belongsTo("family").reload() and model.hasMany("children").reload().

@fivetanley
Copy link
Member

I agree with @pangratz. Keep an eye out for references work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants