karaxnim / karax

Karax. Single page applications for Nim.
MIT License
1.07k stars 90 forks source link

Karax input text becoming null #254

Closed thatrandomperson5 closed 1 year ago

thatrandomperson5 commented 1 year ago

Issue

Get input text being called twice on a node that is found by parentNode.getVNodeById() returns null on the second time. First time returns expected output.

Reproducible Example

include karax / prelude

import karax / [kdom]

proc createDom(): VNode =
  result = buildHtml(tdiv):
    form:
      input(id="username", placeholder="Username")
      input(`type`="submit")

      proc onsubmit(ev: Event, node: VNode) =
        ev.preventDefault()
        let username = node.getVNodeById("username").getInputText
        echo username
        # To see value without error use 'asm "console.log(`username`);"' instead 

setRenderer createDom
geotre commented 1 year ago

Thank you for reporting this issue @thatrandomperson5 . It appears you have hit the same bug that was reported in #117. PR above will fix it.