Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Modify collectAsState to collectAsStateWithLifecycle #976

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

pachuho
Copy link
Contributor

@pachuho pachuho commented Jul 3, 2024

Use collectAsStateWithLifecycle to save app resources when you don't need them,
such as when they're in the background.

The following tasks have been applied.

  1. add dependency androidx.lifecycle.lifecycle-runtime-compose
  2. modify flow to stateFlow in viewModel
  3. modify collectAsState to collectAsStateWithLifecycle in Composable Screen

@pachuho pachuho requested a review from a team as a code owner July 3, 2024 02:34
@pachuho pachuho requested a review from bentrengrove July 3, 2024 02:34
Copy link

google-cla bot commented Jul 3, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Member

@bentrengrove bentrengrove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! This looks really good, just one minor comment to fix

Copy link
Member

@bentrengrove bentrengrove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bentrengrove bentrengrove merged commit 2b60ca9 into android:main Jul 3, 2024
2 checks passed
@pachuho pachuho deleted the consuming_flows_safely branch July 3, 2024 04:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants