-
Notifications
You must be signed in to change notification settings - Fork 664
fix(firestore): ensure limit(0) is properly serialized in query requests #8076
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1608,7 +1608,7 @@ export class Query< | |||||
| structuredQuery.startAt = this.toCursor(this._queryOptions.startAt); | ||||||
| structuredQuery.endAt = this.toCursor(this._queryOptions.endAt); | ||||||
|
|
||||||
| if (this._queryOptions.limit) { | ||||||
| if (this._queryOptions.limit !== undefined) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Suggested change
References
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
| structuredQuery.limit = {value: this._queryOptions.limit}; | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
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 check
this._queryOptions.limit === undefinedcorrectly allows0to be processed in theelseblock, but it changes the behavior fornullvalues. Previously,nullwas treated as "no limit" (entering theifblock), but now it will proceed to theelseblock. To maintain the existing behavior fornullwhile fixing it for0, consider using a nullish check (== null), which is the recommended way to check for bothnullandundefinedin the Google TypeScript Style Guide.References
== nullto check for bothnullandundefined. (link)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.
limitis typed asnumber | undefined. Sonullshouldn't be a valid value.