Starting Monday, December 2nd, I noticed an issue with one of my LiveView projects affecting iPhone users (apparently after the iOS 18.1.1 update). If a user minimizes their browser—e.g., to retrieve some information from another app—and then returns to the browser, LiveView reconnects and all assigns are lost because the LiveView process restarts.
I implemented a quick workaround by caching the assigns using Cachex, but this issue also affects LiveComponents, making it increasingly complex to manage and resolve.
Has anyone experienced a similar issue? Were you able to find a solution?
iOS will close connections when an application is in a suspended/background state, unless it’s registered for services that would allow it to continue to run in the background.
Safari (any mobile browser) on iOS has always functioned this way for as long as I can remember. No workarounds I am aware of.
This is kind of why I don’t like LiveView for mobile-heavy apps - if someone is using the app infrequently eg. unlock phone, do somestuff stuff, lock phone again, then it will need to reconnect each time and the user will see a flash of an error message while the socket is disconnected