diff --git a/src/jsMain/kotlin/io/kvision/core/Widget.kt b/src/jsMain/kotlin/io/kvision/core/Widget.kt index 09d9b9528f5..17244ae80ce 100644 --- a/src/jsMain/kotlin/io/kvision/core/Widget.kt +++ b/src/jsMain/kotlin/io/kvision/core/Widget.kt @@ -795,7 +795,10 @@ open class Widget(internal val className: String? = null, init: (Widget.() -> Un override fun dispose() { afterDestroyInternal() afterDestroy() - afterDestroyHooks?.forEach { it() } + if (vnode != null) { + afterDestroyHooks?.forEach { it() } + afterDestroyHooks?.clear() + } beforeDisposeHooks?.forEach { it() } }