Wilson Castiblanco
10/27/2024, 7:39 PMLazyColumn
which contains a ChatItem
and that item contains a TypingText
Composable (attached to the snippet) and every time I scroll the list when the item is recycled and visible again, the TypingText
is recomposed, so the typing text effect is relaunched causing an undesired experience.
I have made all the composables skippable
and restartable
as I can see in the compose report. Also, there are no more unstable parameters or collections. The list contains an unique key assigned, but this continues recomposing. Is there anything I can do for that? I'd appreciate your thoughts.Stylianos Gakis
10/27/2024, 7:56 PMonTextChange
in composition, you should never do that.composables should be side-effect free. When you need to make changes to the state of the app (as described in the Managing state documentation doc), you should use the Effect APIs so that those side effects are executed in a predictable manner.
edit: I just saw your onTextChange
was a Composable lambda itself. The lowercase text + its name made me think it's not composable, sorry about that.Wilson Castiblanco
10/27/2024, 8:06 PMonTextChange
I had the Text
directly there, but that still does not work 😕Stylianos Gakis
10/27/2024, 8:31 PMWilson Castiblanco
10/27/2024, 9:45 PMWilson Castiblanco
10/27/2024, 9:54 PMWilson Castiblanco
10/27/2024, 9:54 PMStylianos Gakis
10/27/2024, 9:58 PMWhen you provide the contentType, Compose is able to reuse compositions only between the items of the same type. As reusing is more efficient when you compose items of similar structure, providing the content types ensures Compose doesn't try to compose an item of type A on top of a completely different item of type B. This helps maximize the benefits of composition reusing and your Lazy layout performance.
Make sure you do that tooWilson Castiblanco
10/27/2024, 10:00 PMWilson Castiblanco
10/27/2024, 10:04 PMLazyColumn
the contentType without luckWilson Castiblanco
10/27/2024, 10:05 PMWilson Castiblanco
10/27/2024, 10:09 PMWilson Castiblanco
10/27/2024, 10:11 PM@NonRestartableComposable
which is not that good idea, but just in case, but that does not work either.Wilson Castiblanco
10/27/2024, 10:20 PMWilson Castiblanco
10/27/2024, 10:21 PMWilson Castiblanco
10/27/2024, 10:23 PMStylianos Gakis
10/27/2024, 10:28 PMWilson Castiblanco
10/27/2024, 10:30 PMWilson Castiblanco
10/27/2024, 10:31 PMWilson Castiblanco
10/28/2024, 12:57 AMval displayedChats = remember { mutableStateMapOf<String, String>() }
and the chats displayed, are stored there, if the message was already displayed, then it is not going to run the typing effect since the text did not change. 😳Atul Gupta
11/04/2024, 6:08 PMmyanmarking
11/20/2024, 10:31 AM