Skip to content

Commit

Permalink
Support fields in Live Query subscriptions (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimNZ authored and flovilmart committed Dec 1, 2017
1 parent b27ff60 commit 0d7cb39
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/LiveQueryClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,17 @@ 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 @@ -271,15 +274,18 @@ 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

0 comments on commit 0d7cb39

Please sign in to comment.