From cc091973afc3fb866f92c7e355366d661c3f42b2 Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Tue, 24 Aug 2021 02:01:11 +0200 Subject: [PATCH] Invoke disposable effect only if refEffect.effect is not null --- .../kotlin/org/jetbrains/compose/web/elements/Base.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/elements/Base.kt b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/elements/Base.kt index 07ae10c67c..77194f69aa 100644 --- a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/elements/Base.kt +++ b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/elements/Base.kt @@ -81,8 +81,10 @@ fun TagElement( content = content ) - DisposableEffect(null) { - refEffect.effect?.invoke(this, scope.element) ?: onDispose {} + refEffect.effect?.let { refEffect -> + DisposableEffect(null) { + refEffect.invoke(this, scope.element) + } } }