Skip to content

Commit 0a4c43b

Browse files
Comment out multi-tab flag (#1039)
1 parent 23adc0e commit 0a4c43b

File tree

3 files changed

+94
-26
lines changed

3 files changed

+94
-26
lines changed

packages/firebase/index.d.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,27 @@ declare namespace firebase.firestore {
769769
timestampsInSnapshots?: boolean;
770770
}
771771

772+
// TODO(multitab): Uncomment when multi-tab is released publicly.
773+
// /**
774+
// * Settings that can be passed to Firestore.enablePersistence() to configure
775+
// * Firestore persistence.
776+
// */
777+
// export interface PersistenceSettings {
778+
// /**
779+
// * Whether to synchronize the in-memory state of multiple tabs. Setting this
780+
// * to 'true' in all open tabs enables shared access to local persistence,
781+
// * shared execution of queries and latency-compensated local document updates
782+
// * across all connected instances.
783+
// *
784+
// * To enable this mode, `experimentalTabSynchronization:true` needs to be set
785+
// * globally in all active tabs. If omitted or set to 'false',
786+
// * `enablePersistence()` will fail in all but the first tab.
787+
// *
788+
// * NOTE: This mode is not yet recommended for production use.
789+
// */
790+
// experimentalTabSynchronization?: boolean;
791+
// }
792+
772793
export type LogLevel = 'debug' | 'error' | 'silent';
773794

774795
export function setLogLevel(logLevel: LogLevel): void;
@@ -808,6 +829,29 @@ declare namespace firebase.firestore {
808829
*/
809830
enablePersistence(): Promise<void>;
810831

832+
// TODO(multitab): Uncomment when multi-tab is released publicly.
833+
// /**
834+
// * Attempts to enable persistent storage, if possible.
835+
// *
836+
// * Must be called before any other methods (other than settings()).
837+
// *
838+
// * If this fails, enablePersistence() will reject the promise it returns.
839+
// * Note that even after this failure, the firestore instance will remain
840+
// * usable, however offline persistence will be disabled.
841+
// *
842+
// * There are several reasons why this can fail, which can be identified by
843+
// * the `code` on the error.
844+
// *
845+
// * * failed-precondition: The app is already open in another browser tab.
846+
// * * unimplemented: The browser is incompatible with the offline
847+
// * persistence implementation.
848+
// *
849+
// * @param settings Optional settings object to configure persistence.
850+
// * @return A promise that represents successfully enabling persistent
851+
// * storage.
852+
// */
853+
// enablePersistence(settings?: PersistenceSettings): Promise<void>;
854+
811855
/**
812856
* Gets a `CollectionReference` instance that refers to the collection at
813857
* the specified path.

packages/firestore-types/index.d.ts

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,26 @@ export interface Settings {
5757
timestampsInSnapshots?: boolean;
5858
}
5959

60-
/**
61-
* Settings that can be passed to Firestore.enablePersistence() to configure
62-
* Firestore persistence.
63-
*/
64-
export interface PersistenceSettings {
65-
/**
66-
* Whether to synchronize the in-memory state of multiple tabs. Setting this
67-
* to 'true' in all open tabs enables shared access to local persistence,
68-
* shared execution of queries and latency-compensated local document updates
69-
* across all connected instances.
70-
*
71-
* To enable this mode, `experimentalTabSynchronization:true` needs to be set
72-
* globally in all active tabs. If omitted or set to 'false',
73-
* `enablePersistence()` will fail in all but the first tab.
74-
*
75-
* NOTE: This mode is not yet recommended for production use.
76-
*/
77-
experimentalTabSynchronization?: boolean;
78-
}
60+
// TODO(multitab): Uncomment when multi-tab is released publicly.
61+
// /**
62+
// * Settings that can be passed to Firestore.enablePersistence() to configure
63+
// * Firestore persistence.
64+
// */
65+
// export interface PersistenceSettings {
66+
// /**
67+
// * Whether to synchronize the in-memory state of multiple tabs. Setting this
68+
// * to 'true' in all open tabs enables shared access to local persistence,
69+
// * shared execution of queries and latency-compensated local document updates
70+
// * across all connected instances.
71+
// *
72+
// * To enable this mode, `experimentalTabSynchronization:true` needs to be set
73+
// * globally in all active tabs. If omitted or set to 'false',
74+
// * `enablePersistence()` will fail in all but the first tab.
75+
// *
76+
// * NOTE: This mode is not yet recommended for production use.
77+
// */
78+
// experimentalTabSynchronization?: boolean;
79+
// }
7980

8081
export type LogLevel = 'debug' | 'error' | 'silent';
8182

@@ -111,11 +112,33 @@ export class FirebaseFirestore {
111112
* * unimplemented: The browser is incompatible with the offline
112113
* persistence implementation.
113114
*
114-
* @param settings Optional settings object to configure persistence.
115115
* @return A promise that represents successfully enabling persistent
116116
* storage.
117117
*/
118-
enablePersistence(settings?: PersistenceSettings): Promise<void>;
118+
enablePersistence(): Promise<void>;
119+
120+
// TODO(multitab): Uncomment when multi-tab is released publicly.
121+
// /**
122+
// * Attempts to enable persistent storage, if possible.
123+
// *
124+
// * Must be called before any other methods (other than settings()).
125+
// *
126+
// * If this fails, enablePersistence() will reject the promise it returns.
127+
// * Note that even after this failure, the firestore instance will remain
128+
// * usable, however offline persistence will be disabled.
129+
// *
130+
// * There are several reasons why this can fail, which can be identified by
131+
// * the `code` on the error.
132+
// *
133+
// * * failed-precondition: The app is already open in another browser tab.
134+
// * * unimplemented: The browser is incompatible with the offline
135+
// * persistence implementation.
136+
// *
137+
// * @param settings Optional settings object to configure persistence.
138+
// * @return A promise that represents successfully enabling persistent
139+
// * storage.
140+
// */
141+
// enablePersistence(settings?: PersistenceSettings): Promise<void>;
119142

120143
/**
121144
* Gets a `CollectionReference` instance that refers to the collection at

packages/firestore/src/api/database.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ class FirestoreConfig {
202202
persistence: boolean;
203203
}
204204

205+
// TODO(multitab): Replace with Firestore.PersistenceSettings
206+
// tslint:disable-next-line:no-any The definition for these settings is private
207+
export type _PersistenceSettings = any;
208+
205209
/**
206210
* Encapsulates the settings that can be used to configure Firestore
207211
* persistence.
@@ -210,10 +214,7 @@ export class PersistenceSettings {
210214
/** Whether to enable multi-tab synchronization. */
211215
experimentalTabSynchronization: boolean;
212216

213-
constructor(
214-
readonly enabled: boolean,
215-
settings?: firestore.PersistenceSettings
216-
) {
217+
constructor(readonly enabled: boolean, settings?: _PersistenceSettings) {
217218
assert(
218219
enabled || !settings,
219220
'Can only provide PersistenceSettings with persistence enabled'
@@ -327,7 +328,7 @@ export class Firestore implements firestore.FirebaseFirestore, FirebaseService {
327328
return this._firestoreClient.disableNetwork();
328329
}
329330

330-
enablePersistence(settings?: firestore.PersistenceSettings): Promise<void> {
331+
enablePersistence(settings?: _PersistenceSettings): Promise<void> {
331332
if (this._firestoreClient) {
332333
throw new FirestoreError(
333334
Code.FAILED_PRECONDITION,

0 commit comments

Comments
 (0)