Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
mobile ruleP1stack specificStack: android
androidcomposeside-effectslaunchedeffect
Run side effects in Compose effect handlers, not in composition
Launching work or mutating external state directly in a composable body runs on every recomposition; use LaunchedEffect/DisposableEffect.
PR: mobile-canon-2026-06Created: Jul 5, 2026
Bad example
Old codekotlin
| 1 | @Composable fun S(id: Int) { viewModel.load(id) } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codekotlin
| 1 | LaunchedEffect(id) { viewModel.load(id) } |
Explanation (EN)
Objašnjenje (HR)