Atul Gupta
01/22/2024, 10:37 AMinternal object
is annotated with @Immutable
? One ref @Immutable
usage on object
is https://github.com/halilozercan/compose-richtext/blob/edff0f6a59f208a99f79a7636e6d[…]nMain/kotlin/com/halilibo/richtext/markdown/node/AstNodeType.ktAtul Gupta
01/22/2024, 10:38 AMobject
supposed to be Immutable
by default?sindrenm
01/22/2024, 12:35 PM@Immutable
, no, but in many of the cases you linked to, they probably could be.
Kotlin's `object`s don't all need to be immutable, though, as this is perfectly valid:
object Cache {
var value: Value? = null
}
Atul Gupta
01/22/2024, 1:08 PMImmutable
should be used or not?sindrenm
01/22/2024, 1:13 PM@Immutable
for objects such as
object ObjectWithNoBody
and
object ObjectWithAlreadyInferredImmutableValues {
val immutableValue: Int
}
but I'm no expert on this.
I'm also quite sure that any child of a @Immutable
sealed type is also inferred as immutable, so that
@Immutable
internal sealed class AstContainerBlockNodeType
internal object AstDocument : AstContainerBlockNodeType()
internal object AstBlockQuote : AstContainerBlockNodeType()
would infer @Immutable
on both AstDocument
and AstBlockQuote
, as well, but again, I'm not 100% sure about this.eygraber
01/22/2024, 1:22 PMsindrenm
01/22/2024, 1:22 PMAtul Gupta
01/22/2024, 1:23 PMeygraber
01/22/2024, 1:24 PMAtul Gupta
01/22/2024, 3:05 PMImmutable
to a data class which is parameter in compose function but Recomposer state still showing that as changed. is this possible when some data class is marked as Immutable
?eygraber
01/22/2024, 3:06 PMAtul Gupta
01/22/2024, 3:13 PMAtul Gupta
01/22/2024, 3:14 PMdata class
is marked as Immutable
?Atul Gupta
01/22/2024, 3:18 PMkey
in the in lazy list.eygraber
01/22/2024, 3:39 PMAtul Gupta
01/22/2024, 4:40 PMAtul Gupta
01/22/2024, 5:09 PM// put debug here
where you can add debug point and will see Composable fun AbstractLayout(): Arguments: Different: ["item"]
even when UiModel
is marked Immutable
Atul Gupta
01/22/2024, 5:09 PMImmutable
?eygraber
01/22/2024, 5:27 PMAbstractLayout
recomposes when the user scrolls back to a specific item?Atul Gupta
01/22/2024, 5:31 PMAtul Gupta
01/22/2024, 5:31 PMkey
to LazyColumn
Atul Gupta
01/22/2024, 5:33 PMAtul Gupta
01/22/2024, 5:50 PMeygraber
01/22/2024, 6:27 PMis it the case that every branch of sealed class should be markedIf you have a branch that wouldn't be inferred to be stable, you'd have to mark it asImmutable
Immutable
even if the sealed class
itself was marked as Immutable
.Atul Gupta
01/22/2024, 6:32 PMAtul Gupta
01/22/2024, 6:33 PMAs far as seeing a slight jerk, are you running the app in debug or release mode? Unless you're in release mode you can expect to see performance hiccups from time to time.
this I will confirm in release build as well, Right now I am using in Debug build