diff options
author | Robert Jaros <rjaros@finn.pl> | 2020-03-04 18:53:40 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2020-03-04 18:53:40 +0100 |
commit | 0410641a319edadb24c6365ecec2082e4c2ed442 (patch) | |
tree | 29a4423ae2145074bcd931cbae35f313ed13afe2 /src/main/kotlin/pl/treksoft/kvision | |
parent | 503a424b61e55cf680db1c0115de7efaa9d385a8 (diff) | |
download | kvision-0410641a319edadb24c6365ecec2082e4c2ed442.tar.gz kvision-0410641a319edadb24c6365ecec2082e4c2ed442.tar.bz2 kvision-0410641a319edadb24c6365ecec2082e4c2ed442.zip |
Fix stack panel routes handling.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt | 9 |
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 } |