electric-sql / electric-sql/electric
React Native Expo sync stops when app resumes from background
- Dominant language
- TypeScript
- Stars
- 10.4k
- Forks
- 375
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 18
Description
**Versions**
- Client: @tanstack/electric-db-collection 0.3.2
- Electric: 1.5.0
- Platform: React Native / Expo SDK 54 (iOS + Android)
**Bug description**
Problem: When the app goes to background, the HTTP polling loop seems to get stuck. On app resume foreground, Electric's retry backoff doesn't seem to kick in and users don't receive new messages until they kill and relaunch the app.
What I've tried: I found `collection._sync.cleanup()` and `_sync.startSync()` on the internal `_sync` object, but calling `cleanup()` followed by `startSync()` doesn't restart the sync.
My current workaround is wrapping all my collections in `useMemo` and bumping a "resyncKey" on `AppState` change, which forces all collections to be recreated. This works but causes every collection to rebuild simultaneously, which flickers loading states in the UI.
**Expected behavior**
Sync should automatically continue/restart on resume from background state.
Contributor guide
Assessment
This issue has not been assessed yet.