Improves the speed of RobohashAsync by avoiding remember and base64 state.

pull/917/head
Vitor Pamplona 2024-06-14 11:42:27 -04:00
rodzic 8b87f04268
commit 2ded31dd55
1 zmienionych plików z 1 dodań i 2 usunięć

Wyświetl plik

@ -27,7 +27,6 @@ import androidx.compose.foundation.Image
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
@ -88,7 +87,7 @@ fun RobohashFallbackAsyncImage(
loadProfilePicture: Boolean,
) {
if (model != null && loadProfilePicture) {
val isBase64 by remember { derivedStateOf { model.startsWith("data:image/jpeg;base64,") } }
val isBase64 = model.startsWith("data:image/jpeg;base64,")
if (isBase64) {
val context = LocalContext.current