Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapped KVal not updated when KVar is set to its initial value #71

Closed
adamschoenemann opened this issue Aug 14, 2019 · 0 comments
Closed

Comments

@adamschoenemann
Copy link

If you set a KVar back to its initial value, the listening KVals (using map at least) are not updated.
Example code

fun main(args: Array<String>) {
    Kweb(port = 8080) {
        val kv = KVar(0)
        doc.body.new {
            div().new {
                a().on.click { kv.value = 1 }.text("set 1")
            }
            div().new {
                a().on.click { kv.value = 0 }.text("set 0")
            }
            div().new {
                span().text(kv.map { "value: $it" })
            }
        }
    }
}

You can't make the UI update back to "value: 0".

The problem seems to be in KVal:43.

@sanity sanity closed this as completed in eec89ac Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant