Skip to content

LiveQuery should match subobjects with dot notation #3322

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

Merged
merged 2 commits into from
Jan 7, 2017

Conversation

dstarke
Copy link
Contributor

@dstarke dstarke commented Jan 4, 2017

Fixes issue #3321

@facebook-github-bot
Copy link

@dstarke updated the pull request - view changes

@dstarke
Copy link
Contributor Author

dstarke commented Jan 5, 2017

It's unclear why the build failed, but it does not appear to be because of the code in this pull request. The only difference between this check and the previous commit (which passed) was a small addition to a test case which still passes.

Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

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

this looks good to me.

@@ -133,6 +133,13 @@ function matchesKeyConstraints(object, key, constraints) {
if (constraints === null) {
return false;
}
if(key.indexOf(".") >= 0){
Copy link
Contributor

Choose a reason for hiding this comment

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

is 0 really valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it isn't, but I didn't see anywhere that invalid keys should be screened out. In this case, it will recursively call matchesKeyConstraints with an empty object, which should result in the same result as what this code was doing before with an invalid key. You could make the comparison > instead of >=, if you think that makes it more clear, but it should ultimately return the same answer.

@acinader acinader merged commit df029b8 into parse-community:master Jan 7, 2017
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