You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently dealing with issues which come down to the following behavior. Small example with dynamic deletes from a closure event handler:
include karaxprelude
var elements =@[cstring"A", cstring"B", cstring"C", cstring"D", cstring"E"]
procrenderElement(text: cstring, index: int): VNode=kout(cstring"re-building closure for", text, index)
procremove(ev: Event, n: VNode) =kout(cstring"Deleting element from index: ", index)
elements.delete(index)
result=buildHtml():
tdiv(onClick=remove):
text text
procbuildDom(): VNode=result=buildHtml():
tdiv:
for index, text in elements.pairs:
renderElement(text, index)
setRenderer buildDom
The initial render shows elements A B C D E. Clicking on C correctly says Deleting element from index: 2 and the sequence becomes A B D E. From the log output I can see that the VNodes + closures should have been updated correctly. However, clicking e.g. again on the item on index 2 (now the D) produces the log message Deleting element from index: 3, resulting in the wrong element to be deleted. Since the index 3 is D's old index, it looks like the event handler hasn't been updated.
The text was updated successfully, but these errors were encountered:
I'm currently dealing with issues which come down to the following behavior. Small example with dynamic deletes from a closure event handler:
The initial render shows elements A B C D E. Clicking on C correctly says Deleting element from index: 2 and the sequence becomes A B D E. From the log output I can see that the VNodes + closures should have been updated correctly. However, clicking e.g. again on the item on index 2 (now the D) produces the log message Deleting element from index: 3, resulting in the wrong element to be deleted. Since the index 3 is D's old index, it looks like the event handler hasn't been updated.
The text was updated successfully, but these errors were encountered: