File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed
Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ import {
4242 QuerySnapshotBundleData
4343} from '../util/bundle_builder_impl' ;
4444import { Code , FirestoreError } from '../util/error' ;
45- import { logWarn } from '../util/log' ;
4645import { AutoId } from '../util/misc' ;
4746
4847import { Firestore } from './database' ;
@@ -522,8 +521,10 @@ export class DocumentSnapshot<
522521 'previous'
523522 ) ;
524523 if ( documentData . hasPendingWrites ) {
525- logWarn (
526- 'DocumentSnapshot.toJSON serialized a document with pending writes. The pending writes will not be serialized.'
524+ throw new FirestoreError (
525+ Code . FAILED_PRECONDITION ,
526+ 'DocumentSnapshot.toJSON attempted to serialize a document with pending writes. ' +
527+ 'Await `waitForPendingWrites()` before invoking `toJSON()`.'
527528 ) ;
528529 }
529530 builder . addBundleDocument (
@@ -710,8 +711,10 @@ export class QuerySnapshot<
710711 'previous'
711712 ) ;
712713 if ( documentData . hasPendingWrites ) {
713- logWarn (
714- 'QuerySnapshot.toJSON serialized a document with pending writes. The pending writes will not be serialized.'
714+ throw new FirestoreError (
715+ Code . FAILED_PRECONDITION ,
716+ 'QuerySnapshot.toJSON attempted to serialize a document with pending writes. ' +
717+ 'Await `waitForPendingWrites()` before invoking `toJSON()`.'
715718 ) ;
716719 }
717720 docBundleDataArray . push (
Original file line number Diff line number Diff line change @@ -46,8 +46,6 @@ import {
4646} from '../protos/firestore_proto_api' ;
4747import { AutoId } from '../util/misc' ;
4848
49- import { debugAssert } from './assert' ;
50-
5149const BUNDLE_VERSION = 1 ;
5250
5351/**
@@ -107,9 +105,7 @@ export class BundleBuilder {
107105 : null ;
108106
109107 const neitherHasReadTime : boolean = ! docReadTime && origDocReadTime == null ;
110- const docIsNewer : boolean =
111- docReadTime !== undefined &&
112- ( origDocReadTime == null || origDocReadTime < docReadTime ) ;
108+ const docIsNewer : boolean = docReadTime !== undefined && ( origDocReadTime == null || origDocReadTime < docReadTime ) ;
113109 if ( neitherHasReadTime || docIsNewer ) {
114110 // Store document.
115111 this . documents . set ( docBundleData . documentPath , {
@@ -122,7 +118,7 @@ export class BundleBuilder {
122118 exists : docBundleData . documentExists
123119 }
124120 } ) ;
125- }
121+ }
126122 if ( docReadTime && docReadTime > this . latestReadTime ) {
127123 this . latestReadTime = docReadTime ;
128124 }
You can’t perform that action at this time.
0 commit comments