Skip to content

Implement paginated queries for LOI requests to firebase - #3881

Merged
andreia-ferreira merged 4 commits into
masterfrom
andreia/3866/page-loi-reads
Aug 17, 2026
Merged

Implement paginated queries for LOI requests to firebase#3881
andreia-ferreira merged 4 commits into
masterfrom
andreia/3866/page-loi-reads

Conversation

@andreia-ferreira

Copy link
Copy Markdown
Collaborator

Towards #3866

LOIs were fetched in a single unbounded Firestore query and held entirely in memory before anything was written to the local database. For large surveys, this could use a lot of memory and significantly slow down the initial loading.

This PR introduces paginated queries, by requesting only a limited number of documents at a time and writing them to the db before fetching more. For this, the 3 LOI queries were changed to now return Flow<List<LocationOfInterest>> and page through with orderBy(documentId()) + limit + startAfter.

validateGeometry was removed because it just checked for empty geometries, which is something that it's already done by RoomLocationOfInterestStore.insertOrUpdateAll.

@shobhitagarwal1612 PTAL?

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.08%. Comparing base (66eb228) to head (b6bde78).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3881      +/-   ##
============================================
+ Coverage     68.04%   68.08%   +0.04%     
- Complexity     1884     1886       +2     
============================================
  Files           411      411              
  Lines         10881    10877       -4     
  Branches       1426     1423       -3     
============================================
+ Hits           7404     7406       +2     
+ Misses         2734     2733       -1     
+ Partials        743      738       -5     
Files with missing lines Coverage Δ
...android/repository/LocationOfInterestRepository.kt 64.89% <100.00%> (+3.66%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andreia-ferreira
andreia-ferreira merged commit 456a8f4 into master Aug 17, 2026
19 checks passed
@andreia-ferreira
andreia-ferreira deleted the andreia/3866/page-loi-reads branch August 17, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants