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) + } } }