Skip to content

Commit

Permalink
LiveQuery constrains matching fix (parse-community#2357)
Browse files Browse the repository at this point in the history
* Removing sessionToken and authData from _User objects included in a query

This bug caused sessionToken to be replaced on client side to some old
sessionToken from DB.

* Removing dangling variable that is never used

* Checking if object has defined key for Pointer constraints in liveQuery

If there is a liveQuery subscription, with Pointer type constrains (e.g
query.equalTo('user', Parse.User.current())), and new object has
undefined value for that field, we get this error:

    error: Uncaught internal server error. [TypeError: Cannot read
property 'className' of undefined] TypeError: Cannot read property
'className' of undefined
    at matchesKeyConstraints
(…/node_modules/parse-server/lib/LiveQuery/QueryTools.js:145:51)

* LiveQuery constrains matching fix

When constrains == null, we get “Uncaught internal server error”
  • Loading branch information
simonas-notcat authored and Rafael Santos committed Mar 16, 2017
1 parent 2f6741b commit 6adbe75
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/LiveQuery/QueryTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ function matchesQuery(object: any, query: any): boolean {
* Determines whether an object matches a single key's constraints
*/
function matchesKeyConstraints(object, key, constraints) {
if (constraints === null) {
return false;
}
var i;
if (key === '$or') {
for (i = 0; i < constraints.length; i++) {
Expand Down

0 comments on commit 6adbe75

Please sign in to comment.