aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-03-04 18:53:40 +0100
committerRobert Jaros <rjaros@finn.pl>2020-03-04 18:53:40 +0100
commit0410641a319edadb24c6365ecec2082e4c2ed442 (patch)
tree29a4423ae2145074bcd931cbae35f313ed13afe2 /src/main/kotlin/pl/treksoft
parent503a424b61e55cf680db1c0115de7efaa9d385a8 (diff)
downloadkvision-0410641a319edadb24c6365ecec2082e4c2ed442.tar.gz
kvision-0410641a319edadb24c6365ecec2082e4c2ed442.tar.bz2
kvision-0410641a319edadb24c6365ecec2082e4c2ed442.zip
Fix stack panel routes handling.
Diffstat (limited to 'src/main/kotlin/pl/treksoft')
-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
}