If I have something like ```@Composable fun showLi...
# compose
d
If I have something like
Copy code
@Composable
fun showList(actions:MutableSharedFlow<Action>){
    val scope = rememberCoroutineScope()
            Box(contentAlignment = Alignment.Center) {
                Column(Modifier.clickable {
                    scope.launch { actions.emit(NewEvent())}
This works, but if I navigate back to the page, and repeat the action, the event fires 2x, and then 3x if I navigate back etc. What am I missing here? Changing it to a method that's passed in instead of creating a lambda results in what I'd expect
Copy code
@Composable
fun showList(actions:(Action) -> Unit){
    val scope = rememberCoroutineScope()
            Box(contentAlignment = Alignment.Center) {
                Column(Modifier.clickable {
                   actions(NewEvent())
^ that works, I guess it has to do with stable?
z
Which version of compose, and how are you implementing navigation?
d
should be the latest, 1.2.1
z
How are you doing nav?
d
Fragments that hold compose,
Copy code
fun showFragment(fragment: Fragment){
        supportFragmentManager.beginTransaction().replace(R.id.content, fragment, null).addToBackStack(null)).commit()
    }
With one activity
Copy code
override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        return ComposeView(requireContext()).apply {
            setContent {
                MyScreen(viewModel){
                    sendAction(it)
                }
            }
        }
Is the current iteration, before I was passing the SharedFlow in here
z
I have no idea off the top of my head, but @Leland Richardson [G] just rewrote all the underlying infra that modifiers rely on so I would test this on the next release and see if you can still repro (should be 1.3 beta 1 I think)
d
interesting I'll give that a try in a bit ty
l
I dont think my changes will have any effect
I would file a bug
i think it is relayed to the lambda getting memoized in one case and not the other but it shouldn't effect behavior like that