Skip to content

feat: Add support for Parse.Query.include in LiveQuery #2694

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

Open
wants to merge 2 commits into
base: alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/LiveQueryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class LiveQueryClient {
const where = queryJSON.where;
const keys = queryJSON.keys?.split(',');
const watch = queryJSON.watch?.split(',');
const include = queryJSON.include?.split(',');
const subscribeRequest = {
op: OP_TYPES.SUBSCRIBE,
requestId: this.requestId,
Expand All @@ -204,6 +205,7 @@ class LiveQueryClient {
where,
keys,
watch,
include,
},
sessionToken: undefined as string | undefined,
};
Expand Down Expand Up @@ -294,6 +296,7 @@ class LiveQueryClient {
const where = queryJSON.where;
const keys = queryJSON.keys?.split(',');
const watch = queryJSON.watch?.split(',');
const include = queryJSON.include?.split(',');
const className = query.className;
const sessionToken = subscription.sessionToken;
const subscribeRequest = {
Expand All @@ -304,6 +307,7 @@ class LiveQueryClient {
where,
keys,
watch,
include,
},
sessionToken: undefined as string | undefined,
};
Expand Down
8 changes: 8 additions & 0 deletions src/__tests__/LiveQueryClient-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ describe('LiveQueryClient', () => {
};
const query = new ParseQuery('Test');
query.equalTo('key', 'value');
query.include(['key']);

const subscribePromise = liveQueryClient.subscribe(query);
const clientSub = liveQueryClient.subscriptions.get(1);
Expand All @@ -809,6 +810,7 @@ describe('LiveQueryClient', () => {
where: {
key: 'value',
},
include: ['key'],
},
});
});
Expand All @@ -826,6 +828,7 @@ describe('LiveQueryClient', () => {
};
const query = new ParseQuery('Test');
query.equalTo('key', 'value');
query.include(['key']);

const subscribePromise = liveQueryClient.subscribe(query, 'mySessionToken');
const clientSub = liveQueryClient.subscriptions.get(1);
Expand All @@ -848,6 +851,7 @@ describe('LiveQueryClient', () => {
where: {
key: 'value',
},
include: ['key'],
},
});
});
Expand Down Expand Up @@ -946,6 +950,7 @@ describe('LiveQueryClient', () => {
query.equalTo('key', 'value');
query.select(['key']);
query.watch(['key']);
query.include(['key']);
liveQueryClient.subscribe(query);
liveQueryClient.connectPromise.resolve();

Expand All @@ -965,6 +970,7 @@ describe('LiveQueryClient', () => {
},
keys: ['key'],
watch: ['key'],
include: ['key'],
},
});
});
Expand All @@ -984,6 +990,7 @@ describe('LiveQueryClient', () => {
query.equalTo('key', 'value');
query.select(['key']);
query.watch(['key']);
query.include(['key']);
liveQueryClient.subscribe(query, 'mySessionToken');
liveQueryClient.connectPromise.resolve();

Expand All @@ -1004,6 +1011,7 @@ describe('LiveQueryClient', () => {
},
keys: ['key'],
watch: ['key'],
include: ['key'],
},
});
});
Expand Down