-
Notifications
You must be signed in to change notification settings - Fork 40
[MOD-176][Feature] Replace has-many-query with queryHasMany #340
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
[MOD-176][Feature] Replace has-many-query with queryHasMany #340
Conversation
42c98e6 to
c716b56
Compare
| }; | ||
|
|
||
| var other = this.get('_dirtyRelationships.${rel}') || {}; | ||
| var other = this.get(`_dirtyRelationships.${rel}`) || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a drive-by fix -- not sure if it actually caused misbehavior, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, been broke for 2 years: https://github.com/aaxelb/ember-osf/blame/06d0f12f7b486e75fc97d5e8d93b829636e02d90/addon/models/osf-model.js#L68
But, like you said, this is likely not causing any misbehavior, yet...
jamescdavis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a nice solution! Thanks for this!
| }; | ||
|
|
||
| var other = this.get('_dirtyRelationships.${rel}') || {}; | ||
| var other = this.get(`_dirtyRelationships.${rel}`) || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, been broke for 2 years: https://github.com/aaxelb/ember-osf/blame/06d0f12f7b486e75fc97d5e8d93b829636e02d90/addon/models/osf-model.js#L68
But, like you said, this is likely not causing any misbehavior, yet...
| return ArrayPromiseProxy.create({ promise }); | ||
| }, | ||
|
|
||
| __queryHasManyDone(resolve, payload) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the double underscore prefix for "superprivate" methods that should never be called directly (only as a callback). AFAIK, this is not a convention in JS, but I like it.
Purpose
Move the
queryHasManyhelper from ember-osf-reviews to ember-osf. Provides a way to query relationships without going through ember-data, which sometimes decides it has all the data it needs and doesn't make the request.Summary of Changes
queryHasManymethod toosf-modele.g.
user.queryHasMany('nodes', { filter: { title: "My title!", public: true } })Side Effects / Testing Notes
Code that uses
model.query()has to be updated to usemodel.queryHasMany(). In most cases, it's a drop-in replacement, but I didn't want to replace it silently in case someone tries to query abelongsToor somehow depends onember-data-has-many-query-specific behavior.Ticket
https://openscience.atlassian.net/browse/MOD-176
Reviewer Checklist
CHANGELOG.md