Skip to content

Add getQuery(), getQueryFromCache() and getQueryFromServer() #3294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jun 27, 2020

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Jun 25, 2020

This adds getQuery(), getQueryFromCache() and getQueryFromServer() as well as a QuerySnapshot that is heavily inspired by the existing SDK's QuerySnapshot.

Most code churn is to allow code reuse.

@changeset-bot
Copy link

changeset-bot bot commented Jun 25, 2020

🦋 Changeset is good to go

Latest commit: 97f9664

We got this.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 25, 2020

Binary Size Report

Affected SDKs

  • @firebase/firestore

    Type Base (c38fc71) Head (65e67c8) Diff
    browser 249 kB 248 kB -673 B (-0.3%)
    esm2017 194 kB 193 kB -582 B (-0.3%)
    main 494 kB 493 kB -1.47 kB (-0.3%)
    module 246 kB 246 kB -673 B (-0.3%)
  • @firebase/firestore/memory

    Type Base (c38fc71) Head (65e67c8) Diff
    browser 186 kB 186 kB -673 B (-0.4%)
    esm2017 145 kB 145 kB -582 B (-0.4%)
    main 364 kB 362 kB -1.47 kB (-0.4%)
    module 185 kB 184 kB -673 B (-0.4%)
  • firebase

    Type Base (c38fc71) Head (65e67c8) Diff
    firebase-firestore.js 287 kB 286 kB -685 B (-0.2%)
    firebase-firestore.memory.js 226 kB 226 kB -685 B (-0.3%)
    firebase.js 820 kB 819 kB -685 B (-0.1%)

Test Logs

): Promise<QuerySnapshot<T>> {
const internalQuery = cast<Query<T>>(query, Query);
const firestore = cast<Firestore>(query.firestore, Firestore);
return firestore._getFirestoreClient().then(async firestoreClient => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make methods like this fully async? I'm not seeing why they need mixed notation. This applies to the other functions below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The outermost code needs to be async to ensure synchronous function execution, which impacts error propagation and execution order. The cast calls here, for example, would not throw but cause rejected Promises.

@schmidt-sebastian schmidt-sebastian changed the base branch from mrschmidt/getdocfromcache to master June 26, 2020 22:24
@schmidt-sebastian schmidt-sebastian merged commit 5d6b749 into master Jun 27, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/getquery branch July 9, 2020 17:45
@firebase firebase locked and limited conversation to collaborators Jul 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants