@@ -104,8 +104,8 @@ export type ListenSource = 'default' | 'cache';
104
104
* {@link getDocFromCache} or {@link getDocFromServer}.
105
105
*
106
106
* @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.
109
109
*/
110
110
export function getDoc < AppModelType , DbModelType extends DocumentData > (
111
111
reference : DocumentReference < AppModelType , DbModelType >
@@ -142,8 +142,8 @@ export class ExpUserDataWriter extends AbstractUserDataWriter {
142
142
* Reads the document referred to by this `DocumentReference` from cache.
143
143
* Returns an error if the document is not currently cached.
144
144
*
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.
147
147
*/
148
148
export function getDocFromCache < AppModelType , DbModelType extends DocumentData > (
149
149
reference : DocumentReference < AppModelType , DbModelType >
@@ -176,8 +176,8 @@ export function getDocFromCache<AppModelType, DbModelType extends DocumentData>(
176
176
* Reads the document referred to by this `DocumentReference` from the server.
177
177
* Returns an error if the network is not available.
178
178
*
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.
181
181
*/
182
182
export function getDocFromServer <
183
183
AppModelType ,
@@ -205,7 +205,7 @@ export function getDocFromServer<
205
205
* you are offline and the server cannot be reached. To specify this behavior,
206
206
* invoke {@link getDocsFromCache} or {@link getDocsFromServer}.
207
207
*
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.
209
209
*/
210
210
export function getDocs < AppModelType , DbModelType extends DocumentData > (
211
211
query : Query < AppModelType , DbModelType >
@@ -235,7 +235,7 @@ export function getDocs<AppModelType, DbModelType extends DocumentData>(
235
235
* Returns an empty result set if no documents matching the query are currently
236
236
* cached.
237
237
*
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.
239
239
*/
240
240
export function getDocsFromCache <
241
241
AppModelType ,
@@ -263,7 +263,7 @@ export function getDocsFromCache<
263
263
* Executes the query and returns the results as a `QuerySnapshot` from the
264
264
* server. Returns an error if the network is not available.
265
265
*
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.
267
267
*/
268
268
export function getDocsFromServer <
269
269
AppModelType ,
@@ -287,10 +287,26 @@ export function getDocsFromServer<
287
287
* Writes to the document referred to by this `DocumentReference`. If the
288
288
* document does not yet exist, it will be created.
289
289
*
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
+ *
290
305
* @param reference - A reference to the document to write.
291
306
* @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.
294
310
*/
295
311
export function setDoc < AppModelType , DbModelType extends DocumentData > (
296
312
reference : DocumentReference < AppModelType , DbModelType > ,
@@ -301,11 +317,27 @@ export function setDoc<AppModelType, DbModelType extends DocumentData>(
301
317
* the document does not yet exist, it will be created. If you provide `merge`
302
318
* or `mergeFields`, the provided data can be merged into an existing document.
303
319
*
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
+ *
304
335
* @param reference - A reference to the document to write.
305
336
* @param data - A map of the fields and values for the document.
306
337
* @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.
309
341
*/
310
342
export function setDoc < AppModelType , DbModelType extends DocumentData > (
311
343
reference : DocumentReference < AppModelType , DbModelType > ,
@@ -347,12 +379,28 @@ export function setDoc<AppModelType, DbModelType extends DocumentData>(
347
379
* `DocumentReference`. The update will fail if applied to a document that does
348
380
* not exist.
349
381
*
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
+ *
350
397
* @param reference - A reference to the document to update.
351
398
* @param data - An object containing the fields and values with which to
352
399
* update the document. Fields can contain dots to reference nested fields
353
400
* 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.
356
404
*/
357
405
export function updateDoc < AppModelType , DbModelType extends DocumentData > (
358
406
reference : DocumentReference < AppModelType , DbModelType > ,
@@ -366,12 +414,28 @@ export function updateDoc<AppModelType, DbModelType extends DocumentData>(
366
414
* Nested fields can be updated by providing dot-separated field path
367
415
* strings or by providing `FieldPath` objects.
368
416
*
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
+ *
369
432
* @param reference - A reference to the document to update.
370
433
* @param field - The first field to update.
371
434
* @param value - The first value.
372
435
* @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.
375
439
*/
376
440
export function updateDoc < AppModelType , DbModelType extends DocumentData > (
377
441
reference : DocumentReference < AppModelType , DbModelType > ,
@@ -426,9 +490,26 @@ export function updateDoc<AppModelType, DbModelType extends DocumentData>(
426
490
/**
427
491
* Deletes the document referred to by the specified `DocumentReference`.
428
492
*
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
+ *
429
509
* @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.
432
513
*/
433
514
export function deleteDoc < AppModelType , DbModelType extends DocumentData > (
434
515
reference : DocumentReference < AppModelType , DbModelType >
@@ -442,11 +523,26 @@ export function deleteDoc<AppModelType, DbModelType extends DocumentData>(
442
523
* Add a new document to specified `CollectionReference` with the given data,
443
524
* assigning it a document ID automatically.
444
525
*
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
+ *
445
541
* @param reference - A reference to the collection to add this document to.
446
542
* @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 .
450
546
*/
451
547
export function addDoc < AppModelType , DbModelType extends DocumentData > (
452
548
reference : CollectionReference < AppModelType , DbModelType > ,
0 commit comments