-
-
Notifications
You must be signed in to change notification settings - Fork 597
Support object.exists() #898
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #898 +/- ##
==========================================
- Coverage 92.1% 92.05% -0.05%
==========================================
Files 54 54
Lines 5026 5036 +10
Branches 1127 1129 +2
==========================================
+ Hits 4629 4636 +7
- Misses 397 400 +3
Continue to review full report at Codecov.
|
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.
Good job! I have two comments.
src/ParseObject.js
Outdated
await this.fetch(options); | ||
return true; | ||
} catch (e) { | ||
return false; |
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 think we should check e.code === 101
and only return false in this case. Otherwise throw e
. I am afraid that a network issue could be interpreted as an inexistent object.
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 was thinking here again. Maybe do a query by id would be better here instead of the fetch
? I am not sure if the developer, when calling an exists()
function, is expecting the object data to be updated.
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.
Thats a good point.
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.
LGTM!
Returns a promise boolean if the object exists on the server
See parse-community/parse-server#5950