Skip to content

Commit

Permalink
Revert text change from PR 6526 (#7696)
Browse files Browse the repository at this point in the history
* Revert text change from PR 6526

* Clarify text

* Clarify documentation

* Changeset
  • Loading branch information
tom-andersen authored Oct 16, 2023
1 parent 40b3b0f commit 12f2559
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-otters-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/firestore': patch
---

Clarify method documentation.
6 changes: 3 additions & 3 deletions common/api-review/firestore.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,15 @@ export function getDocsFromCache<AppModelType, DbModelType extends DocumentData>
// @public
export function getDocsFromServer<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>;

// @public
export function getFirestore(): Firestore;

// @public
export function getFirestore(app: FirebaseApp): Firestore;

// @beta
export function getFirestore(databaseId: string): Firestore;

// @public
export function getFirestore(): Firestore;

// @beta
export function getFirestore(app: FirebaseApp, databaseId: string): Firestore;

Expand Down
16 changes: 8 additions & 8 deletions docs-devsite/firestore_.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ https://github.com/firebase/firebase-js-sdk
| --- | --- |
| <b>function(app...)</b> |
| [getFirestore(app)](./firestore_.md#getfirestore) | Returns the existing default [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
| [getFirestore(app, databaseId)](./firestore_.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing default [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
| [getFirestore(app, databaseId)](./firestore_.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing named [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
| [initializeFirestore(app, settings, databaseId)](./firestore_.md#initializefirestore) | Initializes a new instance of [Firestore](./firestore_.firestore.md#firestore_class) with the provided settings. Can only be called before any other function, including [getFirestore()](./firestore_.md#getfirestore)<!-- -->. If the custom settings are empty, this function is equivalent to calling [getFirestore()](./firestore_.md#getfirestore)<!-- -->. |
| <b>function(firestore...)</b> |
| [clearIndexedDbPersistence(firestore)](./firestore_.md#clearindexeddbpersistence) | Clears the persistent storage. This includes pending writes and cached documents.<!-- -->Must be called while the [Firestore](./firestore_.firestore.md#firestore_class) instance is not started (after the app is terminated or when the app is first initialized). On startup, this function must be called before other functions (other than [initializeFirestore()](./firestore_.md#initializefirestore) or [getFirestore()](./firestore_.md#getfirestore)<!-- -->)). If the [Firestore](./firestore_.firestore.md#firestore_class) instance is still running, the promise will be rejected with the error code of <code>failed-precondition</code>.<!-- -->Note: <code>clearIndexedDbPersistence()</code> is primarily intended to help write reliable tests that use Cloud Firestore. It uses an efficient mechanism for dropping existing data but does not attempt to securely overwrite or otherwise make cached data unrecoverable. For applications that are sensitive to the disclosure of cached data in between user sessions, we strongly recommend not enabling persistence at all. |
Expand Down Expand Up @@ -49,7 +49,7 @@ https://github.com/firebase/firebase-js-sdk
| [persistentMultipleTabManager()](./firestore_.md#persistentmultipletabmanager) | Creates an instance of <code>PersistentMultipleTabManager</code>. |
| [serverTimestamp()](./firestore_.md#servertimestamp) | Returns a sentinel used with [setDoc()](./firestore_lite.md#setdoc) or [updateDoc()](./firestore_lite.md#updatedoc) to include a server-generated timestamp in the written data. |
| <b>function(databaseId...)</b> |
| [getFirestore(databaseId)](./firestore_.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
| [getFirestore(databaseId)](./firestore_.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing named [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
| <b>function(elements...)</b> |
| [arrayRemove(elements)](./firestore_.md#arrayremove) | Returns a special value that can be used with [setDoc()](./firestore_.md#setdoc) or that tells the server to remove the given elements from any array value that already exists on the server. All instances of each element specified will be removed from the array. If the field being modified is not already an array it will be overwritten with an empty array. |
| [arrayUnion(elements)](./firestore_.md#arrayunion) | Returns a special value that can be used with [setDoc()](./firestore_lite.md#setdoc) or [updateDoc()](./firestore_lite.md#updatedoc) that tells the server to union the given elements with any array value that already exists on the server. Each specified element that doesn't already exist in the array will be added to the end. If the field being modified is not already an array it will be overwritten with an array containing exactly the specified elements. |
Expand Down Expand Up @@ -240,14 +240,14 @@ export declare function getFirestore(app: FirebaseApp): Firestore;

[Firestore](./firestore_.firestore.md#firestore_class)

The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
The default [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.

## getFirestore()

> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns the existing default [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.
Returns the existing named [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.

<b>Signature:</b>

Expand All @@ -266,7 +266,7 @@ export declare function getFirestore(app: FirebaseApp, databaseId: string): Fire

[Firestore](./firestore_.firestore.md#firestore_class)

The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
The named [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.

## initializeFirestore()

Expand Down Expand Up @@ -901,7 +901,7 @@ export declare function getFirestore(): Firestore;

[Firestore](./firestore_.firestore.md#firestore_class)

The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
The default [Firestore](./firestore_.firestore.md#firestore_class) instance of the default app.

## memoryEagerGarbageCollector()

Expand Down Expand Up @@ -947,7 +947,7 @@ export declare function serverTimestamp(): FieldValue;
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns the existing [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.
Returns the existing named [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.

<b>Signature:</b>

Expand All @@ -965,7 +965,7 @@ export declare function getFirestore(databaseId: string): Firestore;

[Firestore](./firestore_.firestore.md#firestore_class)

The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
The named [Firestore](./firestore_.firestore.md#firestore_class) instance of the default app.

## arrayRemove()

Expand Down
26 changes: 13 additions & 13 deletions packages/firestore/src/api/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,43 +195,43 @@ export function initializeFirestore(
});
}

/**
* Returns the existing default {@link Firestore} instance that is associated with the
* default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
* instance with default settings.
*
* @returns The default {@link Firestore} instance of the default app.
*/
export function getFirestore(): Firestore;
/**
* Returns the existing default {@link Firestore} instance that is associated with the
* provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
* instance with default settings.
*
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
* instance is associated with.
* @returns The {@link Firestore} instance of the provided app.
* @returns The default {@link Firestore} instance of the provided app.
*/
export function getFirestore(app: FirebaseApp): Firestore;
/**
* Returns the existing {@link Firestore} instance that is associated with the
* Returns the existing named {@link Firestore} instance that is associated with the
* default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
* instance with default settings.
*
* @param databaseId - The name of the database.
* @returns The {@link Firestore} instance of the provided app.
* @returns The named {@link Firestore} instance of the default app.
* @beta
*/
export function getFirestore(databaseId: string): Firestore;
/**
* Returns the existing default {@link Firestore} instance that is associated with the
* default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
* instance with default settings.
*
* @returns The {@link Firestore} instance of the provided app.
*/
export function getFirestore(): Firestore;
/**
* Returns the existing default {@link Firestore} instance that is associated with the
* Returns the existing named {@link Firestore} instance that is associated with the
* provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
* instance with default settings.
*
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
* instance is associated with.
* @param databaseId - The name of the database.
* @returns The {@link Firestore} instance of the provided app.
* @returns The named {@link Firestore} instance of the provided app.
* @beta
*/
export function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
Expand Down

0 comments on commit 12f2559

Please sign in to comment.