79487971

Date: 2025-03-06 00:32:18
Score: 1
Natty:
Report link

the read and loadData calls are side effects and it will be triggered every time the composable recomposed not only when you dismiss and reopen the dialog . why LaunchedEffect didn't help you ? just with launchedEffect you told the compose compiler you need to execute this one time at the first composition so this will never execute again with every recomposition but when you dismis and reopen the dialog this is a new composition so it will execute again . so ? the best option for me is that make viewModel for this dialog and in the init of this dialog call your methods .... what if one of them you need to call again and again with every dialog open ? just use the launchedEffect(Unit)

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Abdelrahman Esam