Fix iOS orderByKey() crash with startAt()/endAt() — use 1-param native method when key is null#804
Open
Fix iOS orderByKey() crash with startAt()/endAt() — use 1-param native method when key is null#804
Conversation
…tive method When key is null, use the 1-parameter native methods (queryStartingAtValue:, queryEndingAtValue:, queryEqualToValue:) instead of the 2-parameter versions (queryStartingAtValue:childKey:, etc.) which crash when used with queryOrderedByKey: on iOS. Co-authored-by: Reedyuk <3853006+Reedyuk@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [BUG-123] Fix iOS orderByKey() crash with startAt()/endAt()
Fix iOS orderByKey() crash with startAt()/endAt() — use 1-param native method when key is null
Mar 13, 2026
Reedyuk
approved these changes
Mar 13, 2026
Collaborator
|
@nbransby - need approval please, "At least 1 approving review is required by reviewers with write access. Approvals from users that collaborated with the coding agent on changes will not satisfy review requirements." |
Collaborator
|
@copilot can you create unit tests too |
Tests cover: - orderByKey() with both startAt() and endAt() (prefix matching) - orderByKey() with startAt() only - orderByKey() with endAt() only Co-authored-by: Reedyuk <3853006+Reedyuk@users.noreply.github.com>
auto-merge was automatically disabled
March 15, 2026 14:40
Head branch was pushed to by a user without write access
Contributor
Author
Added three integration tests in commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On iOS,
orderByKey()combined withstartAt()/endAt()crashes withInvalidQueryParameter: You must use queryStartingAtValue: instead of queryStartingAtValue:childKey: when using queryOrderedByKey:. The Apple implementation unconditionally called the 2-parameter ObjC methods even whenkeywasnull.startAt(),endAt(),equalTo()(all 3 type overloads each): dispatch to the 1-parameter native method (queryStartingAtValue:,queryEndingAtValue:,queryEqualToValue:) whenkeyisnull, and the 2-parameter version (queryStartingAtValue:childKey:, etc.) whenkeyis provided.commonTestto validateorderByKey()withstartAt()/endAt():testOrderByKeyWithStartAtAndEndAt— prefix matching using bothstartAt()andendAt()(reproduces the original crash scenario)testOrderByKeyWithStartAt—orderByKey()withstartAt()onlytestOrderByKeyWithEndAt—orderByKey()withendAt()onlyOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.