Skip to content

Ember data partial record loading - #31

Closed
drogus wants to merge 7 commits into
emberjs:masterfrom
drogus:ember-data-partial-record-loading
Closed

drogus wants to merge 7 commits into
emberjs:masterfrom
drogus:ember-data-partial-record-loading

Conversation

@drogus

@drogus drogus commented Jan 26, 2015

Copy link
Copy Markdown

This is a bit vague at the moment, but I wanted to put it out for discussion and I'll try to add more details as I get feedback

Rendered

@knownasilya

Copy link
Copy Markdown
Contributor

I really like this idea, especially since I make [model]Simple models just to help with performance. Usually this means returning an id and some kind of pretty identifier, e.g. name.

@rkh

rkh commented Jan 27, 2015

Copy link
Copy Markdown

👍

Partial entities allow nice API optimisations without having to create entity types just made for Ember.js (our current API is quite leaky in this regard unfortunately).

@joostdevries

Copy link
Copy Markdown

@drogus I'd add a option to DS.attr which allows people to explicitly enable/disable this.

@drogus

drogus commented Jan 28, 2015

Copy link
Copy Markdown
Author

@joostdevries could you elaborate? I don't understand what would be the benefit.

@drogus

drogus commented Jan 28, 2015

Copy link
Copy Markdown
Author

I added a note about saving incomplete records.

@joostdevries

Copy link
Copy Markdown

@drogus Right now you're suggesting to implement partial loading by default and allowing people to specify what properties might be missing from their API that should not trigger a server query.

That approach makes this a breaking change because people with API's that somtimes omit properties will get additional server queries all of a sudden.

If you'd instead add an option {async:true} to DS.attr() which defaults to false, people could opt-in to partial record loading and the change would not be breaking.

@drogus

drogus commented Jan 28, 2015

Copy link
Copy Markdown
Author

Right now you're suggesting to implement partial loading by default

I wouldn't turn it on by default, because of backwards compatibility, as you already mentioned. What's more, this can vary between models; it may make sense for only part of your models, especially if you're working with an API, which you don't control. With that in mind, as soon as you enable partial record loading for a model (or all of the models), it should work automatically out of the box.

That said, I agree that there should be an API for a more granular control. I described that in the proposal: https://github.com/emberjs/rfcs/pull/31/files#diff-a99783a2dc2a593ac1cac37a386037c2R86, I believe that your use case (ie. whitelisting or blacklisting properties) is very similar to that one.

@joostdevries

Copy link
Copy Markdown

👍

@workmanw

Copy link
Copy Markdown

👍 This would be so so so awesome for us. We have a noSQL backend and we have a lot of data denormalization. Right now we have "denormed" versions for all of our models. Having partial loading / entity projections would be a welcomed feature.

@mmun mmun added the T-ember-data RFCs that impact the ember-data library label Feb 5, 2015
@drogus

drogus commented Feb 13, 2015

Copy link
Copy Markdown
Author

I've updated the proposal with a bit more specifics, particularly the public API.

@makmanalp

Copy link
Copy Markdown

👍

@igorT

igorT commented May 24, 2015

Copy link
Copy Markdown
Member

@drogus and I refactored this a lot after EmberConf, and were working on an addon that would enable this. We should paste the updated version, and I will close this for now.

@igorT igorT closed this May 24, 2015
@pangratz

Copy link
Copy Markdown
Member

@drogus and I refactored this a lot after EmberConf, and were working on an addon that would enable this

😍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Response T-ember-data RFCs that impact the ember-data library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants