From 15fe79b9f4c940563bdc347043901f3990ab9d2f Mon Sep 17 00:00:00 2001 From: Greg Soltis Date: Wed, 13 Dec 2017 14:22:15 -0800 Subject: [PATCH 1/6] Make disableNetworkInternal explicitly synchronous --- packages/firestore/src/remote/remote_store.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/firestore/src/remote/remote_store.ts b/packages/firestore/src/remote/remote_store.ts index 5c28712af2d..a31fbc555d3 100644 --- a/packages/firestore/src/remote/remote_store.ts +++ b/packages/firestore/src/remote/remote_store.ts @@ -243,16 +243,15 @@ export class RemoteStore { */ disableNetwork(): Promise { // Set the OnlineState to failed so get()'s return from cache, etc. - return this.disableNetworkInternal(OnlineState.Failed); + this.disableNetworkInternal(OnlineState.Failed); + return Promise.resolve(); } /** * Disables the network, setting the OnlineState to the specified * targetOnlineState. */ - private disableNetworkInternal( - targetOnlineState: OnlineState - ): Promise { + private disableNetworkInternal(targetOnlineState: OnlineState) { // NOTE: We're guaranteed not to get any further events from these streams (not even a close // event). this.watchStream.stop(); @@ -265,8 +264,6 @@ export class RemoteStore { this.watchStream = null; this.updateOnlineState(targetOnlineState); - - return Promise.resolve(); } shutdown(): Promise { From 223f5eb23069811070ece576916c234a91a3b1ca Mon Sep 17 00:00:00 2001 From: Greg Soltis Date: Wed, 13 Dec 2017 16:00:34 -0800 Subject: [PATCH 2/6] Add notes to OnlineState type --- packages/firestore/src/core/types.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/firestore/src/core/types.ts b/packages/firestore/src/core/types.ts index 404d896e83b..0751ab77f35 100644 --- a/packages/firestore/src/core/types.ts +++ b/packages/firestore/src/core/types.ts @@ -30,12 +30,17 @@ export type TargetId = number; // they're strings. We should probably (de-)serialize to a common internal type. export type ProtoByteString = Uint8Array | string; -/** Describes the online state of the Firestore client */ +/** + * Describes the online state of the Firestore client. Note that this does not + * indicate whether or not the remote store is trying to connect or not. This is + * primarily used for views determining whether or not raise events from cache. + */ export enum OnlineState { /** * The Firestore client is in an unknown online state. This means the client * is either not actively trying to establish a connection or it is currently * trying to establish a connection, but it has not succeeded or failed yet. + * Events are not raised from cache. */ Unknown, @@ -49,7 +54,7 @@ export enum OnlineState { /** * The client considers itself offline. It is either trying to establish a * connection but failing, or it has been explicitly marked offline via a call - * to disableNetwork(). + * to disableNetwork(). Events will be raised from cache. */ Failed } From a003e01eb0192ff7572dc1a33ff8abc951f9fc3c Mon Sep 17 00:00:00 2001 From: Greg Soltis Date: Wed, 13 Dec 2017 16:01:26 -0800 Subject: [PATCH 3/6] [AUTOMATED]: Prettier Code Styling --- packages/database/test/order_by.test.ts | 4 +- packages/database/test/query.test.ts | 28 +++-------- packages/database/test/transaction.test.ts | 48 +++++-------------- .../src/platform_node/grpc_connection.ts | 6 +-- .../firestore/src/remote/persistent_stream.ts | 4 +- .../test/integration/api/validation.test.ts | 4 +- 6 files changed, 25 insertions(+), 69 deletions(-) diff --git a/packages/database/test/order_by.test.ts b/packages/database/test/order_by.test.ts index 70495f2fd60..b821de62138 100644 --- a/packages/database/test/order_by.test.ts +++ b/packages/database/test/order_by.test.ts @@ -363,9 +363,7 @@ describe('.orderBy tests', function() { expect(addedPrevNames).to.deep.equal(expectedPrevNames); }); - it('Removing default listener removes non-default listener that loads all data', function( - done - ) { + it('Removing default listener removes non-default listener that loads all data', function(done) { const ref = getRandomNode() as Reference; const initial = { key: 'value' }; diff --git a/packages/database/test/query.test.ts b/packages/database/test/query.test.ts index 499748d3edd..bda21cdbb0b 100644 --- a/packages/database/test/query.test.ts +++ b/packages/database/test/query.test.ts @@ -1971,9 +1971,7 @@ describe('Query Tests', function() { expect(val).to.equal(2); }); - it('.startAt() with two arguments works properly (case 1169).', function( - done - ) { + it('.startAt() with two arguments works properly (case 1169).', function(done) { const ref = getRandomNode() as Reference; const data = { Walker: { @@ -2110,9 +2108,7 @@ describe('Query Tests', function() { }); }); - it(".endAt(null, 'f').limitToLast(5) returns the right set of children.", function( - done - ) { + it(".endAt(null, 'f').limitToLast(5) returns the right set of children.", function(done) { const ref = getRandomNode() as Reference; ref.set( { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e', f: 'f', g: 'g', h: 'h' }, @@ -2134,9 +2130,7 @@ describe('Query Tests', function() { ); }); - it('complex update() at query root raises correct value event', function( - done - ) { + it('complex update() at query root raises correct value event', function(done) { const nodePair = getRandomNode(2); const writer = nodePair[0]; const reader = nodePair[1]; @@ -2241,9 +2235,7 @@ describe('Query Tests', function() { }); }); - it('listen for child_added events with limit and different types fires properly', function( - done - ) { + it('listen for child_added events with limit and different types fires properly', function(done) { const nodePair = getRandomNode(2); const writer = nodePair[0]; const reader = nodePair[1]; @@ -2285,9 +2277,7 @@ describe('Query Tests', function() { }); }); - it('listen for child_changed events with limit and different types fires properly', function( - done - ) { + it('listen for child_changed events with limit and different types fires properly', function(done) { const nodePair = getRandomNode(2); const writer = nodePair[0]; const reader = nodePair[1]; @@ -2338,9 +2328,7 @@ describe('Query Tests', function() { }); }); - it('listen for child_remove events with limit and different types fires properly', function( - done - ) { + it('listen for child_remove events with limit and different types fires properly', function(done) { const nodePair = getRandomNode(2); const writer = nodePair[0]; const reader = nodePair[1]; @@ -2442,9 +2430,7 @@ describe('Query Tests', function() { ); }); - it('listen for child_remove events when parent set to scalar', function( - done - ) { + it('listen for child_remove events when parent set to scalar', function(done) { const nodePair = getRandomNode(2); const writer = nodePair[0]; const reader = nodePair[1]; diff --git a/packages/database/test/transaction.test.ts b/packages/database/test/transaction.test.ts index e603105ebc0..d0f44f5accc 100644 --- a/packages/database/test/transaction.test.ts +++ b/packages/database/test/transaction.test.ts @@ -86,9 +86,7 @@ describe('Transaction Tests', function() { }); }); - it('Non-aborted transaction sets committed to true in callback.', function( - done - ) { + it('Non-aborted transaction sets committed to true in callback.', function(done) { const node = getRandomNode() as Reference; node.transaction( @@ -104,9 +102,7 @@ describe('Transaction Tests', function() { ); }); - it('Aborted transaction sets committed to false in callback.', function( - done - ) { + it('Aborted transaction sets committed to false in callback.', function(done) { const node = getRandomNode() as Reference; node.transaction( @@ -236,9 +232,7 @@ describe('Transaction Tests', function() { return ea.promise; }); - it('Second transaction gets run immediately on previous output and only runs once.', function( - done - ) { + it('Second transaction gets run immediately on previous output and only runs once.', function(done) { const nodePair = getRandomNode(2) as Reference[]; let firstRun = false, firstDone = false, @@ -512,9 +506,7 @@ describe('Transaction Tests', function() { ); }); - it('Set should cancel already sent transactions that come back as datastale.', function( - done - ) { + it('Set should cancel already sent transactions that come back as datastale.', function(done) { const nodePair = getRandomNode(2) as Reference[]; let transactionCalls = 0; nodePair[0].set(5, function() { @@ -688,9 +680,7 @@ describe('Transaction Tests', function() { return Promise.all([tx1, tx2]); }); - it('Doing set() in successful transaction callback works. Case 870.', function( - done - ) { + it('Doing set() in successful transaction callback works. Case 870.', function(done) { const node = getRandomNode() as Reference; let transactionCalled = false; let callbackCalled = false; @@ -710,9 +700,7 @@ describe('Transaction Tests', function() { ); }); - it('Doing set() in aborted transaction callback works. Case 870.', function( - done - ) { + it('Doing set() in aborted transaction callback works. Case 870.', function(done) { const nodePair = getRandomNode(2) as Reference[], node1 = nodePair[0], node2 = nodePair[1]; @@ -1028,9 +1016,7 @@ describe('Transaction Tests', function() { ); }); - it('Transaction properly reverts data when you add a deeper listen.', function( - done - ) { + it('Transaction properly reverts data when you add a deeper listen.', function(done) { const refPair = getRandomNode(2) as Reference[], ref1 = refPair[0], ref2 = refPair[1]; @@ -1200,9 +1186,7 @@ describe('Transaction Tests', function() { }); }); - it("transaction() doesn't pick up cached data from previous once().", function( - done - ) { + it("transaction() doesn't pick up cached data from previous once().", function(done) { const refPair = getRandomNode(2) as Reference[]; const me = refPair[0], other = refPair[1]; @@ -1229,9 +1213,7 @@ describe('Transaction Tests', function() { }); }); - it("transaction() doesn't pick up cached data from previous transaction.", function( - done - ) { + it("transaction() doesn't pick up cached data from previous transaction.", function(done) { const refPair = getRandomNode(2) as Reference[]; const me = refPair[0], other = refPair[1]; @@ -1263,9 +1245,7 @@ describe('Transaction Tests', function() { ); }); - it('server values: local timestamp should eventually (but not immediately) match the server with txns', function( - done - ) { + it('server values: local timestamp should eventually (but not immediately) match the server with txns', function(done) { const refPair = getRandomNode(2) as Reference[], writer = refPair[0], reader = refPair[1], @@ -1357,9 +1337,7 @@ describe('Transaction Tests', function() { ); }); - it("transaction() on queried location doesn't run initially on null (firebase-worker-queue depends on this).", function( - done - ) { + it("transaction() on queried location doesn't run initially on null (firebase-worker-queue depends on this).", function(done) { const ref = getRandomNode() as Reference; ref.push({ a: 1, b: 2 }, function() { ref @@ -1437,9 +1415,7 @@ describe('Transaction Tests', function() { ); }); - it('transactions works with merges without the transaction path', function( - done - ) { + it('transactions works with merges without the transaction path', function(done) { const ref = getRandomNode() as Reference; ref.update({ foo: 'bar' }); diff --git a/packages/firestore/src/platform_node/grpc_connection.ts b/packages/firestore/src/platform_node/grpc_connection.ts index 145b2a31889..2b86b3ce95f 100644 --- a/packages/firestore/src/platform_node/grpc_connection.ts +++ b/packages/firestore/src/platform_node/grpc_connection.ts @@ -38,9 +38,9 @@ const LOG_TAG = 'Connection'; // TODO(b/38203344): The SDK_VERSION is set independently from Firebase because // we are doing out-of-band releases. Once we release as part of Firebase, we // should use the Firebase version instead. -const X_GOOG_API_CLIENT_VALUE = `gl-node/${process.versions.node} fire/${ - SDK_VERSION -} grpc/${grpcVersion}`; +const X_GOOG_API_CLIENT_VALUE = `gl-node/${ + process.versions.node +} fire/${SDK_VERSION} grpc/${grpcVersion}`; function createHeaders(databaseInfo: DatabaseInfo, token: Token | null): {} { assert( diff --git a/packages/firestore/src/remote/persistent_stream.ts b/packages/firestore/src/remote/persistent_stream.ts index eb7b1b6a7e7..195c467ca83 100644 --- a/packages/firestore/src/remote/persistent_stream.ts +++ b/packages/firestore/src/remote/persistent_stream.ts @@ -261,9 +261,7 @@ export abstract class PersistentStream< // rejections are not considered unhandled. assert( err.code === Code.CANCELLED, - `Received unexpected error in idle timeout closure. Expected CANCELLED, but was: ${ - err - }` + `Received unexpected error in idle timeout closure. Expected CANCELLED, but was: ${err}` ); }); } diff --git a/packages/firestore/test/integration/api/validation.test.ts b/packages/firestore/test/integration/api/validation.test.ts index 977d80aec4a..031bbe964b1 100644 --- a/packages/firestore/test/integration/api/validation.test.ts +++ b/packages/firestore/test/integration/api/validation.test.ts @@ -172,9 +172,7 @@ apiDescribe('Validation:', persistence => { const collection = db.collection('test-collection'); const doc = collection.doc('test-document'); for (const path of badPaths) { - const reason = `Invalid path (${ - path - }). Paths must not contain // in them.`; + const reason = `Invalid path (${path}). Paths must not contain // in them.`; expect(() => db.collection(path)).to.throw(reason); expect(() => db.doc(path)).to.throw(reason); expect(() => collection.doc(path)).to.throw(reason); From 937fd0f9b4e4ba852057579a2f80493ae7f5af54 Mon Sep 17 00:00:00 2001 From: Greg Soltis Date: Thu, 14 Dec 2017 09:11:59 -0800 Subject: [PATCH 4/6] [AUTOMATED]: Prettier Code Styling --- packages/database/test/order_by.test.ts | 4 +- packages/database/test/query.test.ts | 28 ++++++++--- packages/database/test/transaction.test.ts | 48 ++++++++++++++----- .../src/platform_node/grpc_connection.ts | 6 +-- .../firestore/src/remote/persistent_stream.ts | 4 +- .../test/integration/api/validation.test.ts | 4 +- 6 files changed, 69 insertions(+), 25 deletions(-) diff --git a/packages/database/test/order_by.test.ts b/packages/database/test/order_by.test.ts index b821de62138..70495f2fd60 100644 --- a/packages/database/test/order_by.test.ts +++ b/packages/database/test/order_by.test.ts @@ -363,7 +363,9 @@ describe('.orderBy tests', function() { expect(addedPrevNames).to.deep.equal(expectedPrevNames); }); - it('Removing default listener removes non-default listener that loads all data', function(done) { + it('Removing default listener removes non-default listener that loads all data', function( + done + ) { const ref = getRandomNode() as Reference; const initial = { key: 'value' }; diff --git a/packages/database/test/query.test.ts b/packages/database/test/query.test.ts index bda21cdbb0b..499748d3edd 100644 --- a/packages/database/test/query.test.ts +++ b/packages/database/test/query.test.ts @@ -1971,7 +1971,9 @@ describe('Query Tests', function() { expect(val).to.equal(2); }); - it('.startAt() with two arguments works properly (case 1169).', function(done) { + it('.startAt() with two arguments works properly (case 1169).', function( + done + ) { const ref = getRandomNode() as Reference; const data = { Walker: { @@ -2108,7 +2110,9 @@ describe('Query Tests', function() { }); }); - it(".endAt(null, 'f').limitToLast(5) returns the right set of children.", function(done) { + it(".endAt(null, 'f').limitToLast(5) returns the right set of children.", function( + done + ) { const ref = getRandomNode() as Reference; ref.set( { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e', f: 'f', g: 'g', h: 'h' }, @@ -2130,7 +2134,9 @@ describe('Query Tests', function() { ); }); - it('complex update() at query root raises correct value event', function(done) { + it('complex update() at query root raises correct value event', function( + done + ) { const nodePair = getRandomNode(2); const writer = nodePair[0]; const reader = nodePair[1]; @@ -2235,7 +2241,9 @@ describe('Query Tests', function() { }); }); - it('listen for child_added events with limit and different types fires properly', function(done) { + it('listen for child_added events with limit and different types fires properly', function( + done + ) { const nodePair = getRandomNode(2); const writer = nodePair[0]; const reader = nodePair[1]; @@ -2277,7 +2285,9 @@ describe('Query Tests', function() { }); }); - it('listen for child_changed events with limit and different types fires properly', function(done) { + it('listen for child_changed events with limit and different types fires properly', function( + done + ) { const nodePair = getRandomNode(2); const writer = nodePair[0]; const reader = nodePair[1]; @@ -2328,7 +2338,9 @@ describe('Query Tests', function() { }); }); - it('listen for child_remove events with limit and different types fires properly', function(done) { + it('listen for child_remove events with limit and different types fires properly', function( + done + ) { const nodePair = getRandomNode(2); const writer = nodePair[0]; const reader = nodePair[1]; @@ -2430,7 +2442,9 @@ describe('Query Tests', function() { ); }); - it('listen for child_remove events when parent set to scalar', function(done) { + it('listen for child_remove events when parent set to scalar', function( + done + ) { const nodePair = getRandomNode(2); const writer = nodePair[0]; const reader = nodePair[1]; diff --git a/packages/database/test/transaction.test.ts b/packages/database/test/transaction.test.ts index d0f44f5accc..e603105ebc0 100644 --- a/packages/database/test/transaction.test.ts +++ b/packages/database/test/transaction.test.ts @@ -86,7 +86,9 @@ describe('Transaction Tests', function() { }); }); - it('Non-aborted transaction sets committed to true in callback.', function(done) { + it('Non-aborted transaction sets committed to true in callback.', function( + done + ) { const node = getRandomNode() as Reference; node.transaction( @@ -102,7 +104,9 @@ describe('Transaction Tests', function() { ); }); - it('Aborted transaction sets committed to false in callback.', function(done) { + it('Aborted transaction sets committed to false in callback.', function( + done + ) { const node = getRandomNode() as Reference; node.transaction( @@ -232,7 +236,9 @@ describe('Transaction Tests', function() { return ea.promise; }); - it('Second transaction gets run immediately on previous output and only runs once.', function(done) { + it('Second transaction gets run immediately on previous output and only runs once.', function( + done + ) { const nodePair = getRandomNode(2) as Reference[]; let firstRun = false, firstDone = false, @@ -506,7 +512,9 @@ describe('Transaction Tests', function() { ); }); - it('Set should cancel already sent transactions that come back as datastale.', function(done) { + it('Set should cancel already sent transactions that come back as datastale.', function( + done + ) { const nodePair = getRandomNode(2) as Reference[]; let transactionCalls = 0; nodePair[0].set(5, function() { @@ -680,7 +688,9 @@ describe('Transaction Tests', function() { return Promise.all([tx1, tx2]); }); - it('Doing set() in successful transaction callback works. Case 870.', function(done) { + it('Doing set() in successful transaction callback works. Case 870.', function( + done + ) { const node = getRandomNode() as Reference; let transactionCalled = false; let callbackCalled = false; @@ -700,7 +710,9 @@ describe('Transaction Tests', function() { ); }); - it('Doing set() in aborted transaction callback works. Case 870.', function(done) { + it('Doing set() in aborted transaction callback works. Case 870.', function( + done + ) { const nodePair = getRandomNode(2) as Reference[], node1 = nodePair[0], node2 = nodePair[1]; @@ -1016,7 +1028,9 @@ describe('Transaction Tests', function() { ); }); - it('Transaction properly reverts data when you add a deeper listen.', function(done) { + it('Transaction properly reverts data when you add a deeper listen.', function( + done + ) { const refPair = getRandomNode(2) as Reference[], ref1 = refPair[0], ref2 = refPair[1]; @@ -1186,7 +1200,9 @@ describe('Transaction Tests', function() { }); }); - it("transaction() doesn't pick up cached data from previous once().", function(done) { + it("transaction() doesn't pick up cached data from previous once().", function( + done + ) { const refPair = getRandomNode(2) as Reference[]; const me = refPair[0], other = refPair[1]; @@ -1213,7 +1229,9 @@ describe('Transaction Tests', function() { }); }); - it("transaction() doesn't pick up cached data from previous transaction.", function(done) { + it("transaction() doesn't pick up cached data from previous transaction.", function( + done + ) { const refPair = getRandomNode(2) as Reference[]; const me = refPair[0], other = refPair[1]; @@ -1245,7 +1263,9 @@ describe('Transaction Tests', function() { ); }); - it('server values: local timestamp should eventually (but not immediately) match the server with txns', function(done) { + it('server values: local timestamp should eventually (but not immediately) match the server with txns', function( + done + ) { const refPair = getRandomNode(2) as Reference[], writer = refPair[0], reader = refPair[1], @@ -1337,7 +1357,9 @@ describe('Transaction Tests', function() { ); }); - it("transaction() on queried location doesn't run initially on null (firebase-worker-queue depends on this).", function(done) { + it("transaction() on queried location doesn't run initially on null (firebase-worker-queue depends on this).", function( + done + ) { const ref = getRandomNode() as Reference; ref.push({ a: 1, b: 2 }, function() { ref @@ -1415,7 +1437,9 @@ describe('Transaction Tests', function() { ); }); - it('transactions works with merges without the transaction path', function(done) { + it('transactions works with merges without the transaction path', function( + done + ) { const ref = getRandomNode() as Reference; ref.update({ foo: 'bar' }); diff --git a/packages/firestore/src/platform_node/grpc_connection.ts b/packages/firestore/src/platform_node/grpc_connection.ts index 2b86b3ce95f..145b2a31889 100644 --- a/packages/firestore/src/platform_node/grpc_connection.ts +++ b/packages/firestore/src/platform_node/grpc_connection.ts @@ -38,9 +38,9 @@ const LOG_TAG = 'Connection'; // TODO(b/38203344): The SDK_VERSION is set independently from Firebase because // we are doing out-of-band releases. Once we release as part of Firebase, we // should use the Firebase version instead. -const X_GOOG_API_CLIENT_VALUE = `gl-node/${ - process.versions.node -} fire/${SDK_VERSION} grpc/${grpcVersion}`; +const X_GOOG_API_CLIENT_VALUE = `gl-node/${process.versions.node} fire/${ + SDK_VERSION +} grpc/${grpcVersion}`; function createHeaders(databaseInfo: DatabaseInfo, token: Token | null): {} { assert( diff --git a/packages/firestore/src/remote/persistent_stream.ts b/packages/firestore/src/remote/persistent_stream.ts index 195c467ca83..eb7b1b6a7e7 100644 --- a/packages/firestore/src/remote/persistent_stream.ts +++ b/packages/firestore/src/remote/persistent_stream.ts @@ -261,7 +261,9 @@ export abstract class PersistentStream< // rejections are not considered unhandled. assert( err.code === Code.CANCELLED, - `Received unexpected error in idle timeout closure. Expected CANCELLED, but was: ${err}` + `Received unexpected error in idle timeout closure. Expected CANCELLED, but was: ${ + err + }` ); }); } diff --git a/packages/firestore/test/integration/api/validation.test.ts b/packages/firestore/test/integration/api/validation.test.ts index 031bbe964b1..977d80aec4a 100644 --- a/packages/firestore/test/integration/api/validation.test.ts +++ b/packages/firestore/test/integration/api/validation.test.ts @@ -172,7 +172,9 @@ apiDescribe('Validation:', persistence => { const collection = db.collection('test-collection'); const doc = collection.doc('test-document'); for (const path of badPaths) { - const reason = `Invalid path (${path}). Paths must not contain // in them.`; + const reason = `Invalid path (${ + path + }). Paths must not contain // in them.`; expect(() => db.collection(path)).to.throw(reason); expect(() => db.doc(path)).to.throw(reason); expect(() => collection.doc(path)).to.throw(reason); From 00956efc920417fe3c6bf619e19a9b8c86e8042f Mon Sep 17 00:00:00 2001 From: Greg Soltis Date: Thu, 14 Dec 2017 09:50:01 -0800 Subject: [PATCH 5/6] Update comments per Michael's suggestions --- packages/firestore/src/core/types.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/firestore/src/core/types.ts b/packages/firestore/src/core/types.ts index 0751ab77f35..77eed7cd3ea 100644 --- a/packages/firestore/src/core/types.ts +++ b/packages/firestore/src/core/types.ts @@ -33,14 +33,16 @@ export type ProtoByteString = Uint8Array | string; /** * Describes the online state of the Firestore client. Note that this does not * indicate whether or not the remote store is trying to connect or not. This is - * primarily used for views determining whether or not raise events from cache. + * primarily used by the View / EventManager code to change their behavior while + * offline (e.g. get() calls shouldn't wait for data from the server and + * snapshot events should set metadata.isFromCache=true). */ export enum OnlineState { /** * The Firestore client is in an unknown online state. This means the client * is either not actively trying to establish a connection or it is currently * trying to establish a connection, but it has not succeeded or failed yet. - * Events are not raised from cache. + * Higher-level components should not operate in offline mode. */ Unknown, @@ -52,9 +54,9 @@ export enum OnlineState { Healthy, /** - * The client considers itself offline. It is either trying to establish a - * connection but failing, or it has been explicitly marked offline via a call - * to disableNetwork(). Events will be raised from cache. + * The client is either trying to establish a connection but failing, or it + * has been explicitly marked offline via a call to disableNetwork(). + * Higher-level components should not operate in offline mode. */ Failed } From 7ffcbc9d7d97e28bad4161ff6aed4010570ef545 Mon Sep 17 00:00:00 2001 From: Greg Soltis Date: Thu, 14 Dec 2017 10:03:53 -0800 Subject: [PATCH 6/6] More fixup --- packages/firestore/src/core/types.ts | 2 +- packages/firestore/src/remote/remote_store.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/firestore/src/core/types.ts b/packages/firestore/src/core/types.ts index 77eed7cd3ea..49693083a76 100644 --- a/packages/firestore/src/core/types.ts +++ b/packages/firestore/src/core/types.ts @@ -56,7 +56,7 @@ export enum OnlineState { /** * The client is either trying to establish a connection but failing, or it * has been explicitly marked offline via a call to disableNetwork(). - * Higher-level components should not operate in offline mode. + * Higher-level components should operate in offline mode. */ Failed } diff --git a/packages/firestore/src/remote/remote_store.ts b/packages/firestore/src/remote/remote_store.ts index a31fbc555d3..64422184517 100644 --- a/packages/firestore/src/remote/remote_store.ts +++ b/packages/firestore/src/remote/remote_store.ts @@ -251,7 +251,7 @@ export class RemoteStore { * Disables the network, setting the OnlineState to the specified * targetOnlineState. */ - private disableNetworkInternal(targetOnlineState: OnlineState) { + private disableNetworkInternal(targetOnlineState: OnlineState): void { // NOTE: We're guaranteed not to get any further events from these streams (not even a close // event). this.watchStream.stop();