Skip to content

Commit 93b4117

Browse files
simonas-notcatdrew-gross
authored andcommitted
LiveQuery constrains matching fix (#2357)
* 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”
1 parent a60c3f4 commit 93b4117

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/LiveQuery/QueryTools.js

+3
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ function matchesQuery(object: any, query: any): boolean {
117117
* Determines whether an object matches a single key's constraints
118118
*/
119119
function matchesKeyConstraints(object, key, constraints) {
120+
if (constraints === null) {
121+
return false;
122+
}
120123
var i;
121124
if (key === '$or') {
122125
for (i = 0; i < constraints.length; i++) {

0 commit comments

Comments
 (0)