-
Notifications
You must be signed in to change notification settings - Fork 147
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
fix: support Query.stream() as first client operation #971
Conversation
This fixes a regression introduced in 3.7
Codecov Report
@@ Coverage Diff @@
## master #971 +/- ##
==========================================
- Coverage 97.55% 97.45% -0.11%
==========================================
Files 25 25
Lines 15983 15978 -5
Branches 1283 1208 -75
==========================================
- Hits 15593 15572 -21
- Misses 387 403 +16
Partials 3 3
Continue to review full report at Codecov.
|
@@ -1277,7 +1280,8 @@ describe('limitToLast() interface', () => { | |||
|
|||
it('requires at least one ordering constraints', () => { | |||
const query = firestore.collection('collectionId'); | |||
expect(() => query.limitToLast(1).get()).to.throw( | |||
const result = query.limitToLast(1).get(); | |||
return expect(result).to.eventually.be.rejectedWith( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the refactor in the original PR was meant to ensure that this is thrown as an exception, rather than as a rejected Promise, but it is probably not worth breaking the client for.
dev/src/reference.ts
Outdated
@@ -1989,11 +1986,11 @@ export class Query<T = DocumentData> { | |||
/** | |||
* Internal streaming method that accepts the request proto. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is now outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
); | ||
this.firestore | ||
.initializeIfNeeded(tag) | ||
.then(async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async
is not needed, there is no await
inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment. async
makes sure that any exception from this.toProto
is converted into a rejected Promise.
This fixes a regression introduced in 3.7
Fixes #969