Is there anything special I need to do to prevent a non-state parameter to a composable function from messing with recomposition/skipping?
For example:
Copy code
@Composable
fun Parent(state: State, eventEmitter: EventEmitter<Event>)
eventEmitter
will always be the same instance for a given composition, and uses an identity based
equals
and
hashCode
. Is there anything else that I need to do?
Note that I can't use
CompositionLocal
here because a lot of the events I need to emit occur in non `@Composable`lambdas (e.g.
onClick
).
z
Zach Klippenstein (he/him) [MOD]
08/04/2021, 3:32 AM
Compose should do the right thing automatically. There are a few things you can tweak, but you can never have full control over skipping/recomposition and should not rely on a particular skipping behavior for correctness.
e
eygraber
08/04/2021, 3:34 AM
I guess I'm more concerned about accidentally causing unnecessary recompositions, or preventing skipping from happening when it should be able to.