aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
index 26bfcb8c..84fb6174 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
@@ -25,6 +25,7 @@ import com.github.snabbdom.VNode
import pl.treksoft.kvision.core.Component
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.routing.routing
+import kotlin.browser.window
/**
* The container with only one active (visible) child at any moment.
@@ -80,9 +81,11 @@ open class StackPanel(
add(panel)
val currentIndex = counter++
childrenMap[currentIndex] = panel
- routing.on(route, { _ ->
- activeChild = childrenMap[currentIndex]!!
- }).resolve()
+ window.setTimeout({
+ routing.on(route, { _ ->
+ activeChild = childrenMap[currentIndex]!!
+ }).resolve()
+ }, 0)
return this
}