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

pass DS.SnapshotRecordArray to build-url-mixin buildURL #4304

Merged

Conversation

trevorrjohn
Copy link
Contributor

See discussion: #4302

@@ -47,16 +47,17 @@ export default Ember.Mixin.create({
@param {String} modelName
@param {(String|Array|Object)} id single id or array of ids or query
@param {(DS.Snapshot|Array)} snapshot single snapshot or array of snapshots
@param {(DS.SnapshotRecordArray)} snapshotRecord single snapshotRecordArray
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you don't have to add this parameter here. It is passed as the snapshot argument

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I was confused with this as I wasn't sure if it was an array of Snapshot or the DS.SnapshotRecordArray. Will update...

@trevorrjohn trevorrjohn force-pushed the tj/snapshot-record-array-on-find-all branch from 68f33fe to 2d6639a Compare April 6, 2016 17:07
@trevorrjohn
Copy link
Contributor Author

@pangratz I think this is more along the lines of what you were looking for.

@pangratz
Copy link
Member

pangratz commented Apr 6, 2016

😍 awesome, that was quick! Thank you very much @trevorrjohn!

One tiny thing left: since this is a bugfix, can you prefix the commit with [BUGFIX beta] to make sure this gets into the next beta release?

@trevorrjohn trevorrjohn force-pushed the tj/snapshot-record-array-on-find-all branch from 2d6639a to 47b428f Compare April 6, 2016 17:46
@trevorrjohn
Copy link
Contributor Author

no problem done.

@sly7-7
Copy link
Contributor

sly7-7 commented Apr 6, 2016

Hm, I may be wrong but I think the snapshot(Array) should still be passed in buildUrl, like here:

const url = this.buildURL(type.modelName, null, null, 'findAll');

@trevorrjohn trevorrjohn force-pushed the tj/snapshot-record-array-on-find-all branch from 47b428f to 88dd4e8 Compare April 6, 2016 18:31
@trevorrjohn
Copy link
Contributor Author

you're right, I missed that when I was removing that other code.

@pangratz
Copy link
Member

pangratz commented Apr 6, 2016

Awesome catch @sly7-7. Completely missed that. Looks like this has been removed accidentally when our comments were addressed. Since no tests fail here I think that's a good sign that there is one missing, which tests this scenario.

@trevorrjohn can you pass the snapshotRecordArray where @sly7-7 pointed it out and additionally add a test in tests/integration/adapter/build-url-mixin-test.js, which asserts that a snapshot array is passed to urlForFindAll? You can take this test as an inspiration.

@pangratz
Copy link
Member

pangratz commented Apr 6, 2016

@trevorrjohn nvm, just saw the test you added. That one looks good too!

@sly7-7
Copy link
Contributor

sly7-7 commented Apr 6, 2016

Unfortunately, I don't have the time right now, but I think there are other method where the snapshot is not passed. (here for example

url = this.urlPrefix(url, this.buildURL(type, id, null, 'findHasMany'));
) I'm not sure if we should pass the snapshots where it's available, but in that case, maybe we could add some integration test to have the complete flow tested (from the store.findXXX methods).

@trevorrjohn
Copy link
Contributor Author

Cool! Yeah I had it in the first commit, but accidentally ripped it out
when I was removing the extra param.

On Wed, Apr 6, 2016, 14:41 Clemens Müller notifications@github.com wrote:

@trevorrjohn https://github.com/trevorrjohn nvm, just saw the test you
added. That one looks good too!


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#4304 (comment)

@trevorrjohn
Copy link
Contributor Author

I can look into adding it to the other methods as well.

On Wed, Apr 6, 2016, 14:45 Sylvain MINA notifications@github.com wrote:

Unfortunately, I don't have the time right now, but I think there are
other method where the snapshot is not passed. (here for example

url = this.urlPrefix(url, this.buildURL(type, id, null, 'findHasMany'));
)
I'm not sure if we should pass the snapshots where it's available, but in
that case, maybe we could add some integration test to have the complete
flow tested (from the store.findXXX methods).


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#4304 (comment)

@pangratz
Copy link
Member

pangratz commented Apr 6, 2016

I can look into adding it to the other methods as well.

Let's do that in a separate PR

@trevorrjohn
Copy link
Contributor Author

OK do you want one for each method or can I do the rest in one?

On Wed, Apr 6, 2016, 14:48 Clemens Müller notifications@github.com wrote:

I can look into adding it to the other methods as well.

Let's do that in a separate PR


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#4304 (comment)

@pangratz
Copy link
Member

pangratz commented Apr 6, 2016

Alright, so this gets tricky now, please bear with me: the tests are failing now since you added an assertion here. This assertion will fail since the snapshot array is not passed to buildURL here, where this code path is taken when the ds-improved-ajax feature is enabled.

The feature is not yet available in the beta branch, that's why simply passing the snapshot record array here would indeed make this PR green, but it would make cherry-picking the bugfix into beta complicated (we only want the code path in the beta branch, which is not behind the ds-improved-ajax feature).

So, here's what you need to do (sorry in advance 😔): pass the snapshot array here and commit this change with the message [FEATURE ds-improved-ajax] pass snapshotRecordArray to urlForFindAll.

I will add a team discussion flag here to check that I am not going insane. @trevorrjohn I am very sorry for this mess, your first contribution should NOT be that complicated. If you have any further questions ping me on slack. Thanks for sticking through! You rock!

Note: technically, if every commit in this PR should have a green CI, you would need to rebase the commits and put the feature commit before the bugfix..


OK do you want one for each method or can I do the rest in one?

This could be done in one PR then, but wait before the above is figured out, since I think there will be issues with the ds-improved-ajax feature for urlForFindHasMany / urlForFindBelongsTo as well. I will let you know once that path is clear, so you can work on that PR.

@trevorrjohn trevorrjohn force-pushed the tj/snapshot-record-array-on-find-all branch from 88dd4e8 to 3868436 Compare April 6, 2016 20:34
@pangratz
Copy link
Member

pangratz commented Apr 7, 2016

I discussed this with @bmac and the approach of 2 commits is the way to go here. Thanks @trevorrjohn once again for tackling this and thanks @sly7-7 for your 👀 here! Much appreciated.

Regarding "passing snapshot/snapshots" to urlForFindHasMany / urlForFindBelongsTo: @trevorrjohn the approach is the same as in this PR; so first you need to create the commits for the feature and afterwards the actual bugfix.

@pangratz pangratz merged commit 60f3189 into emberjs:master Apr 7, 2016
@trevorrjohn trevorrjohn deleted the tj/snapshot-record-array-on-find-all branch April 7, 2016 12:51
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