Also there was some suggestion to use it to fetch initial data for a screen rather than using
init
or
LaunchedEffect(Unit)
as it have its own issue.
One problem which I found was the data will be re-fetched if screen is kept in background for more than 5s which is kind of making bad UX if we don't hold data in repo layer.
Are there any better approach for fetching initial data from compose screens ?
d
Dinoy Raj k
07/08/2025, 6:58 AM
If initial data that you are fetching is independent of any navigation ARGS ...always better to go with viewmodel init I think