Skip to content

Commit

Permalink
Send target to backend before local processing (#5980)
Browse files Browse the repository at this point in the history
* Send target to backend before local processing

* Create lemon-ravens-sneeze.md
  • Loading branch information
schmidt-sebastian authored Feb 9, 2022
1 parent bf93a38 commit e961968
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-ravens-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/firestore": patch
---

Queries are now send to the backend before the SDK starts local processing, which reduces overall Query latency.
6 changes: 3 additions & 3 deletions packages/firestore/src/core/sync_engine_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ export async function syncEngineListen(
syncEngineImpl.localStore,
queryToTarget(query)
);
if (syncEngineImpl.isPrimaryClient) {
remoteStoreListen(syncEngineImpl.remoteStore, targetData);
}

const status = syncEngineImpl.sharedClientState.addLocalQueryTarget(
targetData.targetId
Expand All @@ -325,9 +328,6 @@ export async function syncEngineListen(
targetId,
status === 'current'
);
if (syncEngineImpl.isPrimaryClient) {
remoteStoreListen(syncEngineImpl.remoteStore, targetData);
}
}

return viewSnapshot;
Expand Down

0 comments on commit e961968

Please sign in to comment.