From 0410641a319edadb24c6365ecec2082e4c2ed442 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Wed, 4 Mar 2020 18:53:40 +0100 Subject: Fix stack panel routes handling. --- src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/kotlin/pl/treksoft/kvision/panel') 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 } -- cgit