Skip to content

Commit

Permalink
Analysis: Suppress freq. changed state read in composition lint warns
Browse files Browse the repository at this point in the history
Warning Message: "Frequently changing state should not be directly read
in composable function"

Explanation: "This property is observable and is updated after every
scroll or remeasure. If you use it in the composable function directly,
it will be recomposed on every change, causing potential performance
issues including infinity recomposition loops. Prefer wrapping it with
derivedStateOf to use calculation based on this property in composition
or collect changes inside LaunchedEffect instead."

------------------------------------------------------------------------

These Lint warnings are suppressed, that is, instead of them being
resolved, since a resolution would require a proper investigation and
testing. As such, it might be best to ignore this as out of scope, for
now, and so as to not introduce any breaking changes to this scroll
related functionality overall.
  • Loading branch information
ParaskP7 committed Apr 25, 2023
1 parent ebd5152 commit aebc657
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.wordpress.android.ui.main.jetpack.migration.compose.state

import android.annotation.SuppressLint
import android.content.res.Configuration
import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
Expand Down Expand Up @@ -44,6 +45,7 @@ import org.wordpress.android.ui.main.jetpack.migration.compose.components.UserAv
import org.wordpress.android.ui.main.jetpack.migration.compose.dimmed

@Composable
@SuppressLint("FrequentlyChangedStateReadInComposition")
fun WelcomeStep(uiState: UiState.Content.Welcome) = with(uiState) {
Box {
val listState = rememberLazyListState()
Expand Down

0 comments on commit aebc657

Please sign in to comment.