Skip to content

Commit 899c97e

Browse files
committed
deep copy
1 parent 3020c69 commit 899c97e

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

spec/ParseLiveQueryServer.spec.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -776,14 +776,6 @@ describe('ParseLiveQueryServer', function () {
776776

777777
await addMockSubscription(parseLiveQueryServer, clientId, requestId2);
778778

779-
parseLiveQueryServer._matchesSubscription = function (parseObject, subscription) {
780-
if (!parseObject) {
781-
return false;
782-
}
783-
subscription.query.date = { $exists: true };
784-
const matchesQuery = require('../lib/LiveQuery/QueryTools').matchesQuery;
785-
return matchesQuery(parseObject, subscription.query);
786-
};
787779
parseLiveQueryServer._matchesACL = function () {
788780
return Promise.resolve(true);
789781
};

src/LiveQuery/ParseLiveQueryServer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import UserRouter from '../Routers/UsersRouter';
2424
import DatabaseController from '../Controllers/DatabaseController';
2525
import { isDeepStrictEqual } from 'util';
2626
import Deprecator from '../Deprecator/Deprecator';
27+
import deepcopy from 'deepcopy';
2728

2829
class ParseLiveQueryServer {
2930
clients: Map;
@@ -496,7 +497,7 @@ class ParseLiveQueryServer {
496497
if (!parseObject) {
497498
return false;
498499
}
499-
return matchesQuery(parseObject, subscription.query);
500+
return matchesQuery(deepcopy(parseObject), subscription.query);
500501
}
501502

502503
async _clearCachedRoles(userId: string) {

src/LiveQuery/QueryTools.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
var equalObjects = require('./equalObjects');
22
var Id = require('./Id');
33
var Parse = require('parse/node');
4-
const deepcopy = require('deepcopy');
54

65
/**
76
* Query Hashes are deterministic hashes for Parse Queries.
@@ -125,7 +124,6 @@ function contains(haystack: Array, needle: any): boolean {
125124
* queries, we can avoid building a full-blown query tool.
126125
*/
127126
function matchesQuery(object: any, query: any): boolean {
128-
object = deepcopy(object);
129127
if (query instanceof Parse.Query) {
130128
var className = object.id instanceof Id ? object.id.className : object.className;
131129
if (className !== query.className) {

0 commit comments

Comments
 (0)