diff --git a/src/main/kotlin/io/kweb/state/persistent/persistent.kt b/src/main/kotlin/io/kweb/state/persistent/persistent.kt index d3e1b60d73..615faf61fb 100644 --- a/src/main/kotlin/io/kweb/state/persistent/persistent.kt +++ b/src/main/kotlin/io/kweb/state/persistent/persistent.kt @@ -40,6 +40,9 @@ fun main(args: Array) { fun ElementCreator<*>.render(kval : KVal, cacheOnClient : Boolean = false, renderer : ElementCreator.(T) -> Unit) { var childEC = ElementCreator(this.parent, this) val cachedClientECs = if (cacheOnClient) ConcurrentHashMap>() else null + + // Before we set them to display:none, we retrieve the values of the "style" attribute so that we can + // put it back again correctly, because we're thoughtful like that. val retrievedStyleValues = ConcurrentHashMap() val kvalListenerHandle = kval.addListener { oldValue, newValue -> if (oldValue != newValue) { @@ -62,9 +65,6 @@ fun ElementCreator<*>.render(kval : KVal, cacheOnClient : Boolean = if (retainedEC == null) { renderer(childEC, newValue) } else { - // FIXME: Do we need to cache the values of style.display here? I'm assuming - // block, but it could be 'inline' - which would cause some weird - // and tough to track down bugs. retainedEC.elementsCreated.forEach { val prevStyle = retrievedStyleValues[newValue] if (prevStyle == null) {