Skip to content

perf: use lifecycle-aware flow collection in Compose UI#63

Merged
chrisuthe merged 1 commit intomainfrom
worktree-agent-af04f132
Mar 8, 2026
Merged

perf: use lifecycle-aware flow collection in Compose UI#63
chrisuthe merged 1 commit intomainfrom
worktree-agent-af04f132

Conversation

@chrisuthe
Copy link
Copy Markdown
Owner

Summary

  • Replaced all collectAsState() calls with collectAsStateWithLifecycle() across 20 Compose UI files
  • Flows now stop collecting when composables are not visible (e.g., app backgrounded), reducing unnecessary CPU and memory usage
  • The lifecycle-runtime-compose dependency was already present in build.gradle.kts

Test plan

  • Verify app launches and all screens render correctly
  • Background the app and confirm no unnecessary flow collection via profiler/logcat
  • Test NowPlaying, Settings, ServerList, Home, Search, and detail screens for correct state updates
  • Test mini player and queue sheet update correctly
  • Verify Android Auto head unit view still works

…tion

Replace collectAsState() with collectAsStateWithLifecycle() across all
Compose UI code so that flow collection stops when composables are not
visible (e.g., app backgrounded), reducing unnecessary resource usage.
@chrisuthe chrisuthe merged commit 3dce63b into main Mar 8, 2026
@chrisuthe chrisuthe deleted the worktree-agent-af04f132 branch March 8, 2026 02:40
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