Overview
Offline-first means:- Full Functionality: Create, edit, and view expenses offline
- Optimistic Updates: UI updates immediately, syncs later
- Request Queue: Network requests queued and retried automatically
- Conflict Resolution: Automatic handling of conflicting changes
- Cross-Platform: Consistent offline behavior on all platforms
Offline mode is not a “feature” you enable—it’s the foundation of how New Expensify works.
Architecture
Onyx: Offline-First Data Store
New Expensify uses Onyx, a custom state management library built for offline functionality:Data Persistence
Onyx automatically persists data using:- Mobile: SQLite database
- Web: IndexedDB
- Desktop: SQLite (Electron)
Network Detection
Monitoring Connection Status
src/libs/NetworkConnection.ts
Network State
Connection Changes Tracking
src/libs/NetworkConnection.ts
Offline Functionality
Creating Expenses Offline
Optimistic Updates
Request Queue
Network requests are automatically queued when offline:src/libs/Network/NetworkStore.ts
Time Synchronization
Server time skew compensation for accurate timestamps:src/libs/NetworkConnection.ts
Pending States
Pending Actions
Indicate what’s being synced:UI Indicators
Offline Feedback Component
Conflict Resolution
Last Write Wins
By default, the last successful update wins:Error Handling
Retry Failed Requests
Receipt Handling Offline
Receipts captured offline are queued for upload:See Receipt Scanning for details on mobile receipt capture.
Force Offline Mode (Testing)
Force offline for testing:Simulating Poor Connection
Offline Behavior by Feature
Expenses
Reports
Settings
Best Practices
For Users
1
Work Normally Offline
Continue using the app as usual—it will sync when online
2
Watch for Pending Indicators
Gray/dimmed items indicate pending sync
3
Check for Errors
Red error messages indicate sync failures
4
Retry if Needed
Tap retry on error messages if they don’t clear automatically
For Developers
1
Always Use Optimistic Updates
2
Handle Pending States in UI
3
Provide Fallback Data
4
Test Offline Scenarios
Troubleshooting
Changes not syncing
Changes not syncing
- Check internet connection
- Look for error messages on pending items
- Try force closing and reopening the app
- Check for app updates
Stuck pending items
Stuck pending items
Stale data showing
Stale data showing
- Pull to refresh on list screens
- Force sync:
Connection shows offline incorrectly
Connection shows offline incorrectly
Performance Considerations
Storage Limits
- Mobile: ~10 MB typical, can grow larger
- Web: IndexedDB limits vary by browser (~50MB-1GB+)
- Desktop: No practical limit
Data Pruning
Old data is automatically pruned:Queue Management
Next Steps
Receipt Scanning
Offline receipt capture
Push Notifications
Real-time sync notifications
iOS Platform
iOS offline behavior
Android Platform
Android offline behavior
