From 11d3e484df862224c15d20f6171514948981ea90 Mon Sep 17 00:00:00 2001 From: Rahul Lanjewar <63550998+RahulLanjewar93@users.noreply.github.com> Date: Wed, 12 Jun 2024 01:01:10 +0530 Subject: [PATCH 1/2] fix: Live query throws error when constraint `notEqualTo` is set to `null` (#8835) --- spec/ParseLiveQuery.spec.js | 29 +++++++++++++++++++++++++++++ src/LiveQuery/QueryTools.js | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/spec/ParseLiveQuery.spec.js b/spec/ParseLiveQuery.spec.js index 015725ac..789898f6 100644 --- a/spec/ParseLiveQuery.spec.js +++ b/spec/ParseLiveQuery.spec.js @@ -1269,4 +1269,33 @@ describe('ParseLiveQuery', function () { expect(object2.id).toBeDefined(); expect(object3.id).toBeDefined(); }); + + it('triggers query event with constraint not equal to null', async () => { + await reconfigureServer({ + liveQuery: { + classNames: ['TestObject'], + }, + startLiveQueryServer: true, + verbose: false, + silent: true, + }); + + const spy = { + create(obj) { + expect(obj.attributes.foo).toEqual('bar'); + }, + }; + const createSpy = spyOn(spy, 'create'); + const query = new Parse.Query(TestObject); + query.notEqualTo('foo', null); + const subscription = await query.subscribe(); + subscription.on('create', spy.create); + + const object1 = new TestObject(); + object1.set('foo', 'bar'); + await object1.save(); + + await new Promise(resolve => setTimeout(resolve, 100)); + expect(createSpy).toHaveBeenCalledTimes(1); + }); }); diff --git a/src/LiveQuery/QueryTools.js b/src/LiveQuery/QueryTools.js index 1607278f..a8399180 100644 --- a/src/LiveQuery/QueryTools.js +++ b/src/LiveQuery/QueryTools.js @@ -223,7 +223,7 @@ function matchesKeyConstraints(object, key, constraints) { // More complex cases for (var condition in constraints) { compareTo = constraints[condition]; - if (compareTo.__type) { + if (compareTo?.__type) { compareTo = Parse._decode(key, compareTo); } switch (condition) { From 162c07b0a7675401ecaefe76916370369a1d644e Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 11 Jun 2024 19:32:09 +0000 Subject: [PATCH 2/2] chore(release): 7.1.0-alpha.10 [skip ci] # [7.1.0-alpha.10](https://github.com/parse-community/parse-server/compare/7.1.0-alpha.9...7.1.0-alpha.10) (2024-06-11) ### Bug Fixes * Live query throws error when constraint `notEqualTo` is set to `null` ([#8835](https://github.com/parse-community/parse-server/issues/8835)) ([11d3e48](https://github.com/parse-community/parse-server/commit/11d3e484df862224c15d20f6171514948981ea90)) --- changelogs/CHANGELOG_alpha.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/changelogs/CHANGELOG_alpha.md b/changelogs/CHANGELOG_alpha.md index ce048dbf..30525087 100644 --- a/changelogs/CHANGELOG_alpha.md +++ b/changelogs/CHANGELOG_alpha.md @@ -1,3 +1,10 @@ +# [7.1.0-alpha.10](https://github.com/parse-community/parse-server/compare/7.1.0-alpha.9...7.1.0-alpha.10) (2024-06-11) + + +### Bug Fixes + +* Live query throws error when constraint `notEqualTo` is set to `null` ([#8835](https://github.com/parse-community/parse-server/issues/8835)) ([11d3e48](https://github.com/parse-community/parse-server/commit/11d3e484df862224c15d20f6171514948981ea90)) + # [7.1.0-alpha.9](https://github.com/parse-community/parse-server/compare/7.1.0-alpha.8...7.1.0-alpha.9) (2024-05-27) diff --git a/package-lock.json b/package-lock.json index d4bd2418..5088a52e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "parse-server", - "version": "7.1.0-alpha.9", + "version": "7.1.0-alpha.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "parse-server", - "version": "7.1.0-alpha.9", + "version": "7.1.0-alpha.10", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index d793c1a1..80e03908 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "parse-server", - "version": "7.1.0-alpha.9", + "version": "7.1.0-alpha.10", "description": "An express module providing a Parse-compatible API server", "main": "lib/index.js", "repository": {