Skip to content

fix(formulus): sync screen shows correct pending status #522

Merged
najuna-brian merged 1 commit intodevfrom
feature/sync-screen-pending-status-517
Mar 17, 2026
Merged

fix(formulus): sync screen shows correct pending status #522
najuna-brian merged 1 commit intodevfrom
feature/sync-screen-pending-status-517

Conversation

@Mishael-2584
Copy link
Contributor

Description

Fixes the sync screen showing "All synced" when there are unsynced observations (#517).

Problem: After creating an observation and opening the Sync tab, the app could still show "All synced" and 0 pending. The count sometimes updated only later.

Cause:

  1. Pending count was only updated on initial mount, not when returning to the Sync screen.
  2. New observations can have synced_at stored as 0 instead of null; the pending query only checked for null.

Changes:

  • SyncScreen: Use useFocusEffect to run updatePendingUploads() and updatePendingObservations() whenever the Sync screen gains focus, so the status and counts stay correct after creating observations or switching tabs.
  • WatermelonDBRepo.getPendingChanges(): Add Q.where('synced_at', 0) next to the existing Q.eq(null) so never-synced observations are included whether the DB stores synced_at as null or 0. Comment updated to describe what “pending” includes.

Type of Change

  • Bug Fix
  • New Feature / Enhancement
  • Refactor / Code Cleanup
  • Documentation Update
  • Maintenance / Chore
  • Other (please specify):

Component(s) Affected

  • formulus (React Native mobile app)
  • formulus-formplayer (React web app)
  • synkronus (Go backend server)
  • synkronus-cli (Command-line utility)
  • Documentation
  • DevOps / CI/CD
  • Other:

Related Issue(s)

Closes/Fixes/Resolves: Closes #517


Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manually tested
  • Tested on multiple platforms (if applicable)
  • Not applicable

Breaking Changes

  • This PR introduces breaking changes
  • This PR does NOT introduce breaking changes

If breaking changes, please describe migration steps: N/A


Documentation Updates

  • Documentation has been updated
  • Documentation update is not required

Checklist

  • Code follows project style guidelines
  • All existing tests pass
  • New tests added for new functionality
  • PR title follows Conventional Commits format

Thank you for contributing to Open Data Ensemble (ODE)!

- Refresh pending count on Sync screen focus (useFocusEffect) so status
  updates immediately after creating observations
- getPendingChanges: treat synced_at 0 as unsynced so new observations
  are counted whether DB stores null or 0

Made-with: Cursor
@Mishael-2584 Mishael-2584 changed the title fix(formulus): sync screen shows correct pending status (Closes #517) fix(formulus): sync screen shows correct pending status Mar 17, 2026
@najuna-brian najuna-brian merged commit d1f6281 into dev Mar 17, 2026
12 checks passed
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.

[Formulus] Synced status shown incorrect

2 participants