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

New load and sideload methods to align with ember-data APIs #47

Merged
merged 8 commits into from
Sep 12, 2018
Merged

Conversation

ryanto
Copy link
Member

@ryanto ryanto commented Jun 1, 2018

This PR provides APIs for explicitly loading relationship data asynchronously via links or compound documents.

  • Added model.sideload('relationship'): This will fetch the model and slideload the relationship. Since it's using JSON:API includes to fetch data it has the added benefit of fetching multiple relationships in one go (example: post.sideload('comments.author,favorites')). Wouldn't mind calling this including instead of sideload.

  • Added model.load('relationship'): This will fetch the relationship using links, which means the client can now fetch data from URLs provided by the backend without using the include pattern. This is how Ember data works data today with get('relationship').

WIP - This is some code and tests only. Docs and examples need to be updated.

@frank06
Copy link

frank06 commented Jun 1, 2018

👏 🎉

@samselikoff
Copy link
Contributor

Let's use post.loadWith('comments,author') for the includes case

@samselikoff
Copy link
Contributor

scratch that - going with reloadWith('comments,author').

@ryanto ryanto merged commit 76f9ddc into master Sep 12, 2018
@ryanto ryanto deleted the load-v2 branch September 12, 2018 14:24
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

Successfully merging this pull request may close these issues.

3 participants