Skip to content

Query cursors are untyped and cannot take a document #8

Description

@mwpryer

startAt, startAfter, endAt and endBefore on the query builder take ...values: unknown[], so any value compiles. Passing the previous page's document, startAfter(last), compiles and the driver sends the whole document as a map value, so the cursor matches nothing useful and the page repeats or comes back empty. A value of the wrong type, or the wrong number of values for the orderBy chain, compiles the same way. The SDK's own cursor form, startAfter(snapshot), is unreachable because reads return plain documents rather than snapshots, and it is the form that avoids the precision loss in #1. Cursor values should be typed against the preceding orderBy fields, and passing a document should be a compile error until a document can serve as a cursor. Cause: src/core/query.ts:112 types the four cursor methods as unknown[].

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions