Skip to content

Commit 557f190

Browse files
committed
fix Int32Proto encoding of expectedCount
1 parent 8a5faad commit 557f190

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/firestore/src/protos/firestore_proto_api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ export declare namespace firestoreV1ApiClientInterfaces {
399399
readTime?: Timestamp;
400400
targetId?: number;
401401
once?: boolean;
402-
expectedCount?: number;
402+
expectedCount?: number | { value: number };
403403
}
404404
interface TargetChange {
405405
targetChangeType?: TargetChangeTargetChangeType;

packages/firestore/src/remote/serializer.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,10 @@ export function toTarget(
10511051

10521052
if (targetData.resumeToken.approximateByteSize() > 0) {
10531053
result.resumeToken = toBytes(serializer, targetData.resumeToken);
1054-
result.expectedCount = targetData.expectedCount ?? undefined;
1054+
const expectedCount = toInt32Proto(serializer, targetData.expectedCount);
1055+
if (expectedCount !== null) {
1056+
result.expectedCount = expectedCount;
1057+
}
10551058
} else if (targetData.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {
10561059
// TODO(wuandy): Consider removing above check because it is most likely true.
10571060
// Right now, many tests depend on this behaviour though (leaving min() out
@@ -1060,7 +1063,10 @@ export function toTarget(
10601063
serializer,
10611064
targetData.snapshotVersion.toTimestamp()
10621065
);
1063-
result.expectedCount = targetData.expectedCount ?? undefined;
1066+
const expectedCount = toInt32Proto(serializer, targetData.expectedCount);
1067+
if (expectedCount !== null) {
1068+
result.expectedCount = expectedCount;
1069+
}
10641070
}
10651071

10661072
return result;

0 commit comments

Comments
 (0)