Skip to content

Support fields in Live Query subscriptions #518

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

Merged
merged 1 commit into from
Dec 1, 2017
Merged
Changes from all commits
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
14 changes: 10 additions & 4 deletions src/LiveQueryClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,17 @@ export default class LiveQueryClient extends EventEmitter {
if (!query) {
return;
}
let where = query.toJSON().where;
let className = query.className;
let queryJSON = query.toJSON();
let where = queryJSON.where;
let fields = queryJSON.keys ? queryJSON.keys.split(',') : undefined;
let subscribeRequest = {
op: OP_TYPES.SUBSCRIBE,
requestId: this.requestId,
query: {
className,
where
where,
fields
}
};

Expand Down Expand Up @@ -277,15 +280,18 @@ export default class LiveQueryClient extends EventEmitter {
resubscribe() {
this.subscriptions.forEach((subscription, requestId) => {
let query = subscription.query;
let where = query.toJSON().where;
let queryJSON = query.toJSON();
let where = queryJSON.where;
let fields = queryJSON.keys ? queryJSON.keys.split(',') : undefined;
let className = query.className;
let sessionToken = subscription.sessionToken;
let subscribeRequest = {
op: OP_TYPES.SUBSCRIBE,
requestId,
query: {
className,
where
where,
fields
}
};

Expand Down