Skip to content

Commit

Permalink
Remove experimentalTabSynchronization (#3943)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian committed Oct 15, 2020
1 parent 2c1764d commit 344bd88
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 33 deletions.
6 changes: 6 additions & 0 deletions .changeset/shy-trees-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"firebase": major
"@firebase/firestore": major
---

Removed depreacted `experimentalTabSynchronization` settings. To enable multi-tab sychronization, use `synchronizeTabs` instead.
17 changes: 3 additions & 14 deletions packages/firebase/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ declare namespace firebase.functions {
/**
* Changes this instance to point to a Cloud Functions emulator running
* locally. See https://firebase.google.com/docs/functions/local-emulator
*
*
* @deprecated Prefer the useEmulator(host, port) method.
* @param origin The origin of the local emulator, such as
* "http://localhost:5005".
Expand Down Expand Up @@ -3132,10 +3132,10 @@ declare namespace firebase.auth {
*/
useDeviceLanguage(): void;
/**
* Modify this Auth instance to communicate with the Firebase Auth emulator. This must be
* Modify this Auth instance to communicate with the Firebase Auth emulator. This must be
* called synchronously immediately following the first call to `firebase.auth()`. Do not use
* with production credentials as emulator traffic is not encrypted.
*
*
* @param url The URL at which the emulator is running (eg, 'http://localhost:9099')
*/
useEmulator(url: string): void;
Expand Down Expand Up @@ -7954,17 +7954,6 @@ declare namespace firebase.firestore {
*/
synchronizeTabs?: boolean;

/**
* Whether to synchronize the in-memory state of multiple tabs. Setting this
* to `true` in all open tabs enables shared access to local persistence,
* shared execution of queries and latency-compensated local document updates
* across all connected instances.
*
* @deprecated This setting is deprecated. To enable synchronization between
* multiple tabs, please use `synchronizeTabs: true` instead.
*/
experimentalTabSynchronization?: boolean;

/**
* Whether to force enable persistence for the client. This cannot be used
* with `synchronizeTabs:true` and is primarily intended for use with Web
Expand Down
29 changes: 10 additions & 19 deletions packages/firestore/src/api/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const CACHE_SIZE_UNLIMITED = LruParams.COLLECTION_DISABLED;

// enablePersistence() defaults:
const DEFAULT_SYNCHRONIZE_TABS = false;
const DEFAULT_FORCE_OWNING_TAB = false;

/** Undocumented, private additional settings not exposed in our public API. */
interface PrivateSettings extends PublicSettings {
Expand Down Expand Up @@ -461,26 +462,16 @@ export class Firestore implements PublicFirestore, FirebaseService {
let experimentalForceOwningTab = false;

if (settings) {
if (settings.experimentalTabSynchronization !== undefined) {
logError(
"The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead."
);
}
synchronizeTabs =
settings.synchronizeTabs ??
settings.experimentalTabSynchronization ??
DEFAULT_SYNCHRONIZE_TABS;

experimentalForceOwningTab = settings.experimentalForceOwningTab
? settings.experimentalForceOwningTab
: false;
synchronizeTabs = settings.synchronizeTabs ?? DEFAULT_SYNCHRONIZE_TABS;
experimentalForceOwningTab =
settings.experimentalForceOwningTab ?? DEFAULT_FORCE_OWNING_TAB;

if (synchronizeTabs && experimentalForceOwningTab) {
throw new FirestoreError(
Code.INVALID_ARGUMENT,
"The 'experimentalForceOwningTab' setting cannot be used with 'synchronizeTabs'."
);
}
validateIsNotUsedTogether(
'synchronizeTabs',
synchronizeTabs,
'experimentalForceOwningTab',
experimentalForceOwningTab
);
}

return this.configureClient(
Expand Down

0 comments on commit 344bd88

Please sign in to comment.