Fix performance issue reported by Konsist test Sealed interface used in Composable MUST be Immutable or Stable

This commit is contained in:
Benoit Marty 2024-05-29 18:03:39 +02:00 committed by Benoit Marty
parent b994a1ea91
commit 7348f74702
6 changed files with 14 additions and 0 deletions

View file

@ -16,6 +16,7 @@
package io.element.android.features.messages.impl.attachments.preview
import androidx.compose.runtime.Immutable
import io.element.android.features.messages.impl.attachments.Attachment
data class AttachmentsPreviewState(
@ -24,8 +25,11 @@ data class AttachmentsPreviewState(
val eventSink: (AttachmentsPreviewEvents) -> Unit
)
@Immutable
sealed interface SendActionState {
data object Idle : SendActionState
@Immutable
sealed interface Sending : SendActionState {
data object Processing : Sending
data class Uploading(val progress: Float) : Sending

View file

@ -16,8 +16,10 @@
package io.element.android.features.messages.impl.sender
import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color
@Immutable
sealed interface SenderNameMode {
data class Timeline(val mainColor: Color) : SenderNameMode
data object Reply : SenderNameMode