Skip to content

Commit

Permalink
fix null versionstamp (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
codehz authored Aug 1, 2024
1 parent f724aed commit 7d47a7e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions npm/src/proto_based.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,6 @@ export class WatchCache {
}
}

//

const emptyVersionstamp = new Uint8Array(10);

function computeReadRangeForKey(packedKey: Uint8Array): ReadRange {
return {
start: packedKey,
Expand All @@ -264,7 +260,9 @@ function computeKvCheckMessage(
return {
key: packKey(key),
versionstamp: (versionstamp === null || versionstamp === undefined)
? emptyVersionstamp
/* in proto3 all fields are optional, but the generated types don't
* like it, so we have to cast it manually */
? undefined as unknown as Uint8Array
: decodeHex(versionstamp),
};
}
Expand Down

0 comments on commit 7d47a7e

Please sign in to comment.