Skip to content

perf: migration to lifecycle-aware state collection in Compose#1192

Merged
theovilardo merged 2 commits intomasterfrom
optim/collect-as-lifecycle-replacement
Feb 22, 2026
Merged

perf: migration to lifecycle-aware state collection in Compose#1192
theovilardo merged 2 commits intomasterfrom
optim/collect-as-lifecycle-replacement

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

  • Replace collectAsState() with collectAsStateWithLifecycle() across the entire presentation layer to ensure resource-efficient state collection.
  • Impacted screens and components include LibraryScreen, PlayerSheet, HomeScreen, Settings, Search, and various detail views (Artist, Album, Genre, Playlist).
  • Update MainActivity and ExternalPlayerActivity to use lifecycle-aware collection for theme and setup state.
  • Add androidx.lifecycle:lifecycle-runtime-compose dependency to app/build.gradle.kts and version catalog.
  • MainViewModel: Update isSetupComplete to use Boolean? with a null initial value to distinguish between "loading" and "incomplete" states during app startup.
  • MainActivity: Refactor setup screen visibility logic to prevent flickering by explicitly checking for the null initialization state.

- Replace `collectAsState()` with `collectAsStateWithLifecycle()` across the entire presentation layer to ensure resource-efficient state collection.
- Impacted screens and components include `LibraryScreen`, `PlayerSheet`, `HomeScreen`, `Settings`, `Search`, and various detail views (Artist, Album, Genre, Playlist).
- Update `MainActivity` and `ExternalPlayerActivity` to use lifecycle-aware collection for theme and setup state.
- Add `androidx.lifecycle:lifecycle-runtime-compose` dependency to `app/build.gradle.kts` and version catalog.
- **MainViewModel**: Update `isSetupComplete` to use `Boolean?` with a `null` initial value to distinguish between "loading" and "incomplete" states during app startup.
- **MainActivity**: Refactor setup screen visibility logic to prevent flickering by explicitly checking for the `null` initialization state.
@theovilardo theovilardo merged commit 00aa81c into master Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant