Skip to content

Commit de34b1b

Browse files
committed
get() server data must be indexed + transaction fix
1 parent d680986 commit de34b1b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/database/src/core/Repo.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,19 @@ export function repoGetValue(repo: Repo, query: QueryContext): Promise<Node> {
458458
}
459459
return repo.server_.get(query).then(
460460
payload => {
461-
const node = nodeFromJSON(payload as string);
461+
const node = nodeFromJSON(payload as string).withIndex(
462+
query._queryParams.getIndex()
463+
);
462464
const events = syncTreeApplyServerOverwrite(
463465
repo.serverSyncTree_,
464466
query._path,
465467
node
466468
);
467-
eventQueueRaiseEventsAtPath(repo.eventQueue_, query._path, events);
469+
let affectedPath = query._path;
470+
if (events.length > 0) {
471+
affectedPath = repoRerunTransactions(repo, query._path);
472+
}
473+
eventQueueRaiseEventsAtPath(repo.eventQueue_, affectedPath, events);
468474
return Promise.resolve(node);
469475
},
470476
err => {

0 commit comments

Comments
 (0)