Skip to content

Commit e961968

Browse files
Send target to backend before local processing (#5980)
* Send target to backend before local processing * Create lemon-ravens-sneeze.md
1 parent bf93a38 commit e961968

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/lemon-ravens-sneeze.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": patch
3+
---
4+
5+
Queries are now send to the backend before the SDK starts local processing, which reduces overall Query latency.

packages/firestore/src/core/sync_engine_impl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ export async function syncEngineListen(
314314
syncEngineImpl.localStore,
315315
queryToTarget(query)
316316
);
317+
if (syncEngineImpl.isPrimaryClient) {
318+
remoteStoreListen(syncEngineImpl.remoteStore, targetData);
319+
}
317320

318321
const status = syncEngineImpl.sharedClientState.addLocalQueryTarget(
319322
targetData.targetId
@@ -325,9 +328,6 @@ export async function syncEngineListen(
325328
targetId,
326329
status === 'current'
327330
);
328-
if (syncEngineImpl.isPrimaryClient) {
329-
remoteStoreListen(syncEngineImpl.remoteStore, targetData);
330-
}
331331
}
332332

333333
return viewSnapshot;

0 commit comments

Comments
 (0)