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

Adds support for multiple $in, pointer / relation queries on $or #769

Merged
merged 4 commits into from
Mar 3, 2016

Conversation

flovilmart
Copy link
Contributor

No description provided.

let t = schema.getExpectedType(className, key);
let match = t ? t.match(/^relation<(.*)>$/) : false;
if (!match) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should produce an inconsistent return type from the function, not sure if that is expected behavior or not. You are returning void or a Promise (later one down the line). Maybe convert to Promise.resolve(), but don't feel strongly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's enclosed into a promise.then() , so that's pretty much the same as doing return Promise.resolve();

Copy link
Contributor

Choose a reason for hiding this comment

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

Still an inconsistent return type from a closure(lambda?), but nature of JS wins here.

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@flovilmart flovilmart changed the title Adds support for multiple $in Adds support for multiple $in, pointer / relation queries on $or Mar 2, 2016
@flovilmart
Copy link
Contributor Author

Proposed fix for #432 and #550

}
return Promise.resolve();

return Object.keys(query).reduce((promise, key) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest using Promise.all rather than reduce when possible, you should get slightly better perf that way, and IMO it's more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was wondering about race conditions in that case, but that's fine for me

Copy link
Contributor

Choose a reason for hiding this comment

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

all can lead to race conditions, but I think in this case it won't.

@drew-gross
Copy link
Contributor

Can you prefer to use promises in tests instead of the backbone style callbacks? We are moving away from the backbone style. No need to spend a lot of time fixing this one, just for next tests.

@flovilmart
Copy link
Contributor Author

No problemo, I'll do the Promise.all and fix the tests.

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@flovilmart flovilmart force-pushed the flovilmart.fixFailingQueries branch from ded60a6 to d872f52 Compare March 3, 2016 01:37
@facebook-github-bot
Copy link

@flovilmart updated the pull request.

flovilmart added a commit that referenced this pull request Mar 3, 2016
Adds support for multiple $in, pointer / relation queries on $or
@flovilmart flovilmart merged commit dac7101 into master Mar 3, 2016
@flovilmart flovilmart deleted the flovilmart.fixFailingQueries branch March 3, 2016 03:15
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.

4 participants