DanielMartinus / Konfetti

Celebrate more with this lightweight confetti particle system 🎊
ISC License
3.13k stars 299 forks source link

KonfettiView is unstable #316

Open Nek-12 opened 9 months ago

Nek-12 commented 9 months ago
@Composable
fun KonfettiView(
    modifier: Modifier = Modifier,
    parties: List<Party>,
    updateListener: OnParticleSystemUpdateListener? = null
) 

The KonfettiView composable is non-skippable and non-restartable because the parties parameter is unstable, as well as OnParticleSystemUpdateListener

Soluiton: Replace update listener with a lambda using rememberUpdatedState and wrap List<Parties> in an object that is marked as @Immutable

This issue has a serious performance impact as ConfettiView is being recomposed every time unrelated parameters change.