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

[BUGFIX release] Load many2many relationships correctly #5142

Closed
wants to merge 1 commit into from
Closed

[BUGFIX release] Load many2many relationships correctly #5142

wants to merge 1 commit into from

Conversation

jrjohnson
Copy link
Contributor

Fair warning, I really don't know what this fix does. I think the original commit I'm patching had a small logic error that this fixes, but I hope @stefanpenner (who did the original work) can verify that. This change does fix the issue I was seeing though so I'm hopeful it is correct.

When a many2many relationship exists and more than one related item is
included in the relationship ensure that both sides load completely.

This issue was introduced in e430ede

Fixes #5140

When a many2many relationship exists and more than one related item is
included in the relationship ensure that both sides load completely.

This issue was introduced in e430ede
@@ -209,7 +209,7 @@ export default class ManyRelationship extends Relationship {

for (let i = 0; i< internalModels.length; i++) {
let internalModel = internalModels[i];
if (this.canonicalMembers.has(internalModel)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm super confused how these end up being different. So thank you for providing a test which I can debug :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefanpenner I wondered that too, and I think could be a side effect here: https://github.com/emberjs/data/blob/master/addon/-private/system/relationships/state/relationship.js#L167 which add internal models to the relationship canoninal members. So this may leads to this.canonicalMembers and forCanonicalbeeing different

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, that seems to be it.

@stefanpenner
Copy link
Member

stefanpenner commented Aug 24, 2017

@jrjohnson thanks for the PR, after debugging your failing test I now see the issue! I have adapted your fix slightly (just a simplification, but your still the committer) -> #5144

@jrjohnson
Copy link
Contributor Author

Great! I'm glad it put you on the right track. My fix was pretty much a shot in the dark.

@jrjohnson jrjohnson deleted the 5140-query branch August 24, 2017 16:29
@stefanpenner
Copy link
Member

@jrjohnson your fix and test really made this super actionable. I wish all bug reports came this way :)

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.

2.14.7 regression store.query breaks some many2many relationships
3 participants