Skip to content

Commit 2a5039e

Browse files
authored
get() server data must be indexed (#4796)
1 parent 3f3fc95 commit 2a5039e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/rotten-wombats-shop.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/database': patch
3+
---
4+
5+
Fix `index not defined` errors for orderByChild get requests

packages/database/src/core/Repo.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,9 @@ export function repoGetValue(repo: Repo, query: QueryContext): Promise<Node> {
466466
}
467467
return repo.server_.get(query).then(
468468
payload => {
469-
const node = nodeFromJSON(payload as string);
469+
const node = nodeFromJSON(payload as string).withIndex(
470+
query._queryParams.getIndex()
471+
);
470472
const events = syncTreeApplyServerOverwrite(
471473
repo.serverSyncTree_,
472474
query._path,

0 commit comments

Comments
 (0)