Skip to content

Commit 209f35b

Browse files
authored
LDS: query.fromNetwork() (#1002)
Taken from Android API [fromNetwork()](http://parseplatform.org/Parse-SDK-Android/api/com/parse/ParseQuery.html#fromNetwork--)
1 parent a9c3000 commit 209f35b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/ParseQuery.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,17 @@ class ParseQuery {
17741774
return query;
17751775
}
17761776

1777+
/**
1778+
* Change the source of this query to the server.
1779+
*
1780+
* @return {Parse.Query} Returns the query, so you can chain this call.
1781+
*/
1782+
fromNetwork(): ParseQuery {
1783+
this._queriesLocalDatastore = false;
1784+
this._localDatastorePinName = null;
1785+
return this;
1786+
}
1787+
17771788
/**
17781789
* Changes the source of this query to all pinned objects.
17791790
*

src/__tests__/ParseQuery-test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,6 +2346,10 @@ describe('ParseQuery LocalDatastore', () => {
23462346
q.fromPin();
23472347
expect(q._queriesLocalDatastore).toBe(true);
23482348
expect(q._localDatastorePinName).toBe(DEFAULT_PIN);
2349+
const query = q.fromNetwork();
2350+
expect(q._queriesLocalDatastore).toBe(false);
2351+
expect(q._localDatastorePinName).toBe(null);
2352+
expect(query).toEqual(q);
23492353
});
23502354

23512355
it('can query from pin with name', () => {

0 commit comments

Comments
 (0)