-
Notifications
You must be signed in to change notification settings - Fork 26
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
Discussion about keeping the loading process of relationships #42
Comments
I created the branch issue-42 in which:
Please have a look to sebweaver@6daa383 to see these important changes. All test pass, and ELA is now thinner! |
@sebweaver I think I am in favour of all of this. There is a lot of code coming from the But, keep in mind, since we still save everything in one So, for the record, could you indicate which models need an upgrade after this merges in? I mean for people that have |
Depending on your reply, we could decide when introduce the breaking changes. Your PRs to Ember Data will probably be merged into ED 2.1.0 so maybe we could introduce these 'breaking' changes together with removing the current workarounds around those PRs. And then we release ELA 2.1.0. |
Performance About that, I totally agree with you. These changes improve the load on the store, but due to the current implementation (i.e. one unique key to contain the whole database) it doesn't change anything on the memory footprint. The latter is not the purpose of this PR (and I have other ideas about that very topic...) The purposes were:
Needed changes You're right. The migration process is quite simple and almost natural if done in the same time of migration to ED 2.0 (which introduced Release plan Your plan for releasing these changes in 2.1 sound good to me, specially about removing the workarounds in the same time. I thought about some new test cases which seem to be missing in the current test suite, but I don't known when I can do that. So, do you want the PR as is, right now, and I'll add these new tests in another dedicated PR? Or do you prefer I'll add them in the same PR but later? |
@sebweaver Alright, let's move this in with ED 2.1. I think the PR does not require any changes. I only want to ship an upgrade guide with the release since we might break things. Is it correct that only people that will be affected by this change are people using a relation by |
Yes, indeed. To be clearer, here is a table which should cover the different migration scenarios:
Migration example for affected getters: var record = model.get('association')
record.get('whatever');
record.doSomething(); Becomes: model.get('association').then(function(record) {
record.get('whatever');
record.doSomething();
}) Please feel free to correct/improve/enrich this migration helper. |
@sebweaver Wonderful. I extracted the table to the upgrade guide. Do you agree? |
Then you could create a PR of your commit and we merge it in. |
On second thought, the above table is actually squashing the changes required by ED migration and the ones required by ELA, whereas some of them are introduced at different version. So I think it's even clearer to split the table, as follows: Changes required by migration from ED < 2.0 to ED >= 2.0:
Then the following changes are required by migration from ELA 2.0 to ELA 2.1:
Plus the same example as before. |
@sebweaver Alright, I will change that. Can you create the PR? |
Implemented. |
Currently, when ELA fetch records it also takes the responsibility of loading all their relationships.
This raises several issues:
true
orfalse
). In other words, in applications where relationships are set to be async (which is now the default in Ember Data 2.0), ELA will do a lot of unnecessary work for nothing. All the more as this work can be very expensive when a lot of records with a lot a nested relationships are fetched.findAll()
should also callloadRelationshipsForMany()
, asfindMany()
does.Considering all of these points, my question is: do we still need to maintain this complicated and unnecessary behavior?
My opinion is: no, we don't. I think the adapter should limit its responsibility by focusing only on the basic CRUD operations, those ones required by the store, and let the latter handles its own sophisticated mechanisms. ELA would be more lightweight and consequently more maintainable. We could stick to ED changes more easily too.
The counterpart of this decision is it would introduce some possible breaking changes on existing applications using ELA:
{ async: false }
to embedded relationships and let the default to the non embedded onesPromise
returned by async relationships (rather than a direct read of the value)However, this could not be that important, because ED 2.0 introduced breaking changes too. As a matter of fact, ELA migration could be part of the overall migration process to ED 2.0.
Happy to read your POV about all of this.
Regards,
Sébastien
The text was updated successfully, but these errors were encountered: