Skip to content

Commit

Permalink
The addAfterDestroyHook called twice (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjaros committed Dec 1, 2024
1 parent adf3ad3 commit cf1f5c7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/jsMain/kotlin/io/kvision/core/Widget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
}

Expand Down

0 comments on commit cf1f5c7

Please sign in to comment.