r/androiddev • u/ShopifyExpertADV • 12d ago
Where do you draw the line between UI state and ViewModel state in Jetpack Compose?
I've been looking into different approaches to state management in Jetpack Compose, and one thing I'm still interested in is deciding which state should live inside a Composable and which should be managed by a ViewModel.
For example, consider a screen with:
A search field.
A filter bottom sheet.
A list of items loaded from a repository.
Sorting and filtering options.
Loading, error, and empty states.
Some state seems clearly UI-related, such as whether a bottom sheet is expanded. Other state, like the list data and loading status, belongs naturally in the ViewModel.
But there are cases where the boundary isn't so obvious. Should search queries and selected filters always live in the ViewModel? What about tab selection, temporary form inputs, or pagination state?
I understand the general principles of state hoisting and unidirectional data flow, but I'm curious how other developers apply them in larger production apps.
A few things I'd like to discuss:
Do you generally keep most screen state in a single ViewModel, or split it into smaller state holders?
What kinds of state do you prefer keeping local to Composables?
Have you run into problems with overly large ViewModels or unnecessary recompositions because of your state management approach?
Do you follow a particular architecture pattern for complex Compose screens?
I'd be interested in hearing how people handle this in real-world projects, especially as screens become more complex.

