@@ -1855,11 +1855,11 @@ function serializeCursor(key: IndexKey): string {
18551855 key . map (
18561856 ( v ) : Value =>
18571857 v === undefined
1858- ? "$_ "
1859- : typeof v === "string" && v . endsWith ( "$_ " )
1860- ? // in the unlikely case their string was "$_" or "$$_" etc.
1861- // we need to escape it. Always add a $ so "$$_" becomes "$$$_"
1862- "$ " + v
1858+ ? "undefined "
1859+ : typeof v === "string" && v . endsWith ( "undefined " )
1860+ ? // in the unlikely case their string was "undefined"
1861+ // or "_undefined" etc, we escape it.
1862+ "_ " + v
18631863 : v ,
18641864 ) ,
18651865 ) ,
@@ -1869,16 +1869,17 @@ function serializeCursor(key: IndexKey): string {
18691869function deserializeCursor ( cursor : string ) : IndexKey {
18701870 return ( jsonToConvex ( JSON . parse ( cursor ) ) as Value [ ] ) . map ( ( v ) => {
18711871 if ( typeof v === "string" ) {
1872- if ( v === "$_ " ) {
1872+ if ( v === "undefined " ) {
18731873 // This is a special case for the undefined value.
18741874 // It's not a valid value in the index, but it's a valid value in the
18751875 // cursor.
18761876 return undefined ;
18771877 }
1878- if ( v . endsWith ( "$_" ) ) {
1879- // in the unlikely case their string was "$_" it was changed to "$$_"
1880- // in the serialization process. If it was "$$_", it was changed to
1881- // "$$$_" and so on.
1878+ if ( v . endsWith ( "undefined" ) ) {
1879+ // in the unlikely case their string was "undefined" it was changed to
1880+ // "_undefined" in the serialization process.
1881+ // NB: if their string was "_undefined" it was changed to
1882+ // "__undefined" in the serialization process, and so on.
18821883 return v . slice ( 1 ) ;
18831884 }
18841885 }
0 commit comments