Skip to content

Remove experimentalTabSynchronization #3943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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