@@ -104,8 +104,8 @@ export type ListenSource = 'default' | 'cache';
104104 * {@link getDocFromCache} or {@link getDocFromServer}.
105105 *
106106 * @param reference - The reference of the document to fetch.
107- * @returns A Promise resolved with a `DocumentSnapshot` containing the
108- * current document contents.
107+ * @returns A ` Promise` that resolves with a `DocumentSnapshot` containing the
108+ * document contents.
109109 */
110110export function getDoc < AppModelType , DbModelType extends DocumentData > (
111111 reference : DocumentReference < AppModelType , DbModelType >
@@ -142,8 +142,8 @@ export class ExpUserDataWriter extends AbstractUserDataWriter {
142142 * Reads the document referred to by this `DocumentReference` from cache.
143143 * Returns an error if the document is not currently cached.
144144 *
145- * @returns A `Promise` resolved with a `DocumentSnapshot` containing the
146- * current document contents.
145+ * @returns A `Promise` that resolves with a `DocumentSnapshot` containing the
146+ * document contents.
147147 */
148148export function getDocFromCache < AppModelType , DbModelType extends DocumentData > (
149149 reference : DocumentReference < AppModelType , DbModelType >
@@ -176,8 +176,8 @@ export function getDocFromCache<AppModelType, DbModelType extends DocumentData>(
176176 * Reads the document referred to by this `DocumentReference` from the server.
177177 * Returns an error if the network is not available.
178178 *
179- * @returns A `Promise` resolved with a `DocumentSnapshot` containing the
180- * current document contents.
179+ * @returns A `Promise` that resolves with a `DocumentSnapshot` containing the
180+ * document contents.
181181 */
182182export function getDocFromServer <
183183 AppModelType ,
@@ -205,7 +205,7 @@ export function getDocFromServer<
205205 * you are offline and the server cannot be reached. To specify this behavior,
206206 * invoke {@link getDocsFromCache} or {@link getDocsFromServer}.
207207 *
208- * @returns A `Promise` that will be resolved with the results of the query.
208+ * @returns A `Promise` that resolves with the results of the query.
209209 */
210210export function getDocs < AppModelType , DbModelType extends DocumentData > (
211211 query : Query < AppModelType , DbModelType >
@@ -235,7 +235,7 @@ export function getDocs<AppModelType, DbModelType extends DocumentData>(
235235 * Returns an empty result set if no documents matching the query are currently
236236 * cached.
237237 *
238- * @returns A `Promise` that will be resolved with the results of the query.
238+ * @returns A `Promise` that resolves with the results of the query.
239239 */
240240export function getDocsFromCache <
241241 AppModelType ,
@@ -263,7 +263,7 @@ export function getDocsFromCache<
263263 * Executes the query and returns the results as a `QuerySnapshot` from the
264264 * server. Returns an error if the network is not available.
265265 *
266- * @returns A `Promise` that will be resolved with the results of the query.
266+ * @returns A `Promise` that resolves with the results of the query.
267267 */
268268export function getDocsFromServer <
269269 AppModelType ,
@@ -287,10 +287,26 @@ export function getDocsFromServer<
287287 * Writes to the document referred to by this `DocumentReference`. If the
288288 * document does not yet exist, it will be created.
289289 *
290+ * Note that the returned `Promise` does _not_ resolve until the data is
291+ * successfully written to the remote Firestore backend and, similarly, is not
292+ * rejected until the remote Firestore backend reports an error saving the given
293+ * data. So if the client cannot reach the backend, for example due to being
294+ * offline, then the returned `Promise` will not resolve for a potentially-long
295+ * time, for example until the client has gone back online. That being said,
296+ * the given data _will_ be immediately saved to the local cache and will be
297+ * incorporated into future "get" operations as if it had been successfully
298+ * written to the remote Firestore server. The data will _eventually_ be written
299+ * to the remote Firestore backend once a connection can be established.
300+ * Therefore, it is usually undesirable to `await` the `Promise` returned from
301+ * this function because the indefinite amount of time before which the promise
302+ * resolves/rejects can block application logic unnecessarily, instead ignoring
303+ * the returned `Promise` and carrying on as if it had resolved.
304+ *
290305 * @param reference - A reference to the document to write.
291306 * @param data - A map of the fields and values for the document.
292- * @returns A `Promise` resolved once the data has been successfully written
293- * to the backend (note that it won't resolve while you're offline).
307+ * @returns A `Promise` that resolves once the data has been successfully
308+ * written to the backend or rejects once the backend reports an error writing
309+ * the data.
294310 */
295311export function setDoc < AppModelType , DbModelType extends DocumentData > (
296312 reference : DocumentReference < AppModelType , DbModelType > ,
@@ -301,11 +317,27 @@ export function setDoc<AppModelType, DbModelType extends DocumentData>(
301317 * the document does not yet exist, it will be created. If you provide `merge`
302318 * or `mergeFields`, the provided data can be merged into an existing document.
303319 *
320+ * Note that the returned `Promise` does _not_ resolve until the data is
321+ * successfully written to the remote Firestore backend and, similarly, is not
322+ * rejected until the remote Firestore backend reports an error saving the given
323+ * data. So if the client cannot reach the backend, for example due to being
324+ * offline, then the returned `Promise` will not resolve for a potentially-long
325+ * time, for example until the client has gone back online. That being said,
326+ * the given data _will_ be immediately saved to the local cache and will be
327+ * incorporated into future "get" operations as if it had been successfully
328+ * written to the remote Firestore server. The data will _eventually_ be written
329+ * to the remote Firestore backend once a connection can be established.
330+ * Therefore, it is usually undesirable to `await` the `Promise` returned from
331+ * this function because the indefinite amount of time before which the promise
332+ * resolves/rejects can block application logic unnecessarily, instead ignoring
333+ * the returned `Promise` and carrying on as if it had resolved.
334+ *
304335 * @param reference - A reference to the document to write.
305336 * @param data - A map of the fields and values for the document.
306337 * @param options - An object to configure the set behavior.
307- * @returns A Promise resolved once the data has been successfully written
308- * to the backend (note that it won't resolve while you're offline).
338+ * @returns A `Promise` that resolves once the data has been successfully
339+ * written to the backend or rejects once the backend reports an error writing
340+ * the data.
309341 */
310342export function setDoc < AppModelType , DbModelType extends DocumentData > (
311343 reference : DocumentReference < AppModelType , DbModelType > ,
@@ -347,12 +379,28 @@ export function setDoc<AppModelType, DbModelType extends DocumentData>(
347379 * `DocumentReference`. The update will fail if applied to a document that does
348380 * not exist.
349381 *
382+ * Note that the returned `Promise` does _not_ resolve until the data is
383+ * successfully written to the remote Firestore backend and, similarly, is not
384+ * rejected until the remote Firestore backend reports an error saving the given
385+ * data. So if the client cannot reach the backend, for example due to being
386+ * offline, then the returned `Promise` will not resolve for a potentially-long
387+ * time, for example until the client has gone back online. That being said,
388+ * the given data _will_ be immediately saved to the local cache and will be
389+ * incorporated into future "get" operations as if it had been successfully
390+ * written to the remote Firestore server. The data will _eventually_ be written
391+ * to the remote Firestore backend once a connection can be established.
392+ * Therefore, it is usually undesirable to `await` the `Promise` returned from
393+ * this function because the indefinite amount of time before which the promise
394+ * resolves/rejects can block application logic unnecessarily, instead ignoring
395+ * the returned `Promise` and carrying on as if it had resolved.
396+ *
350397 * @param reference - A reference to the document to update.
351398 * @param data - An object containing the fields and values with which to
352399 * update the document. Fields can contain dots to reference nested fields
353400 * within the document.
354- * @returns A `Promise` resolved once the data has been successfully written
355- * to the backend (note that it won't resolve while you're offline).
401+ * @returns A `Promise` that resolves once the data has been successfully
402+ * written to the backend or rejects once the backend reports an error writing
403+ * the data.
356404 */
357405export function updateDoc < AppModelType , DbModelType extends DocumentData > (
358406 reference : DocumentReference < AppModelType , DbModelType > ,
@@ -366,12 +414,28 @@ export function updateDoc<AppModelType, DbModelType extends DocumentData>(
366414 * Nested fields can be updated by providing dot-separated field path
367415 * strings or by providing `FieldPath` objects.
368416 *
417+ * Note that the returned `Promise` does _not_ resolve until the data is
418+ * successfully written to the remote Firestore backend and, similarly, is not
419+ * rejected until the remote Firestore backend reports an error saving the given
420+ * data. So if the client cannot reach the backend, for example due to being
421+ * offline, then the returned `Promise` will not resolve for a potentially-long
422+ * time, for example until the client has gone back online. That being said,
423+ * the given data _will_ be immediately saved to the local cache and will be
424+ * incorporated into future "get" operations as if it had been successfully
425+ * written to the remote Firestore server. The data will _eventually_ be written
426+ * to the remote Firestore backend once a connection can be established.
427+ * Therefore, it is usually undesirable to `await` the `Promise` returned from
428+ * this function because the indefinite amount of time before which the promise
429+ * resolves/rejects can block application logic unnecessarily, instead ignoring
430+ * the returned `Promise` and carrying on as if it had resolved.
431+ *
369432 * @param reference - A reference to the document to update.
370433 * @param field - The first field to update.
371434 * @param value - The first value.
372435 * @param moreFieldsAndValues - Additional key value pairs.
373- * @returns A `Promise` resolved once the data has been successfully written
374- * to the backend (note that it won't resolve while you're offline).
436+ * @returns A `Promise` that resolves once the data has been successfully
437+ * written to the backend or rejects once the backend reports an error writing
438+ * the data.
375439 */
376440export function updateDoc < AppModelType , DbModelType extends DocumentData > (
377441 reference : DocumentReference < AppModelType , DbModelType > ,
@@ -426,9 +490,26 @@ export function updateDoc<AppModelType, DbModelType extends DocumentData>(
426490/**
427491 * Deletes the document referred to by the specified `DocumentReference`.
428492 *
493+ * Note that the returned `Promise` does _not_ resolve until the document is
494+ * successfully deleted from the remote Firestore backend and, similarly, is not
495+ * rejected until the remote Firestore backend reports an error deleting the
496+ * document. So if the client cannot reach the backend, for example due to being
497+ * offline, then the returned `Promise` will not resolve for a potentially-long
498+ * time, for example until the client has gone back online. That being said,
499+ * the given document _will_ be immediately deleted in the local cache and will
500+ * be reflected in future "get" operations as if it had been successfully
501+ * deleted from the remote Firestore server. The document will _eventually_ be
502+ * deleted from the remote Firestore backend once a connection can be
503+ * established. Therefore, it is usually undesirable to `await` the `Promise`
504+ * returned from this function because the indefinite amount of time before
505+ * which the promise resolves/rejects can block application logic unnecessarily,
506+ * instead ignoring the returned `Promise` and carrying on as if it had
507+ * resolved.
508+ *
429509 * @param reference - A reference to the document to delete.
430- * @returns A Promise resolved once the document has been successfully
431- * deleted from the backend (note that it won't resolve while you're offline).
510+ * @returns A `Promise` that resolves once the document has been successfully
511+ * deleted from the backend or rejects once the backend reports an error
512+ * deleting the document.
432513 */
433514export function deleteDoc < AppModelType , DbModelType extends DocumentData > (
434515 reference : DocumentReference < AppModelType , DbModelType >
@@ -442,11 +523,26 @@ export function deleteDoc<AppModelType, DbModelType extends DocumentData>(
442523 * Add a new document to specified `CollectionReference` with the given data,
443524 * assigning it a document ID automatically.
444525 *
526+ * Note that the returned `Promise` does _not_ resolve until the document is
527+ * successfully created in the remote Firestore backend and, similarly, is not
528+ * rejected until the remote Firestore backend reports an error creating the
529+ * document. So if the client cannot reach the backend, for example due to being
530+ * offline, then the returned `Promise` will not resolve for a potentially-long
531+ * time, for example until the client has gone back online. That being said,
532+ * the given data _will_ be immediately saved to the local cache and will be
533+ * incorporated into future "get" operations as if it had been successfully
534+ * written to the remote Firestore server. The data will _eventually_ be written
535+ * to the remote Firestore backend once a connection can be established.
536+ * Therefore, it is usually undesirable to `await` the `Promise` returned from
537+ * this function because the indefinite amount of time before which the promise
538+ * resolves/rejects can block application logic unnecessarily, instead ignoring
539+ * the returned `Promise` and carrying on as if it had resolved.
540+ *
445541 * @param reference - A reference to the collection to add this document to.
446542 * @param data - An Object containing the data for the new document.
447- * @returns A `Promise` resolved with a `DocumentReference` pointing to the
448- * newly created document after it has been written to the backend (Note that it
449- * won't resolve while you're offline) .
543+ * @returns A `Promise` that resolves once the docoument has been successfully
544+ * created in the backend or rejects once the backend reports an error creating
545+ * the document .
450546 */
451547export function addDoc < AppModelType , DbModelType extends DocumentData > (
452548 reference : CollectionReference < AppModelType , DbModelType > ,
0 commit comments