81
app lifecycle
Foreground, background, killed. Resume must not assume the screen you left is still valid.
What is app lifecycle?
The OS moves an app through states: not running, inactive, background, foreground. It may kill you in the background. Timers lie. Network calls you started may return after resume to a dead screen.
Why does app lifecycle matter when vibe coding?
Models start a fetch on mount and set state whenever it returns. Background the app, get a warning, or update a screen that unmounted. Name resume and cancellation.
How do you do app lifecycle?
Cancel work on blur or unmount. Refresh stale data on foreground if the user was gone. Do not depend on a timer that the OS suspended. Persist drafts before backgrounding.
How do you ask a model for app lifecycle?
Handle app lifecycle. Cancel requests on unmount. Refresh (screen) when returning to foreground. Persist drafts before background. Do not assume a timer kept running.
What goes wrong with app lifecycle?
Refreshing the whole app on every resume so the user loses scroll position. Refresh the data, keep the place.