cferdinandi / reef

A lightweight library for creating reactive, state-based components and UI.
https://reefjs.com
MIT License
1.16k stars 77 forks source link

Input fields not updated to reflect data changes #150

Closed nbullock closed 2 years ago

nbullock commented 2 years ago

Test case: https://codepen.io/troglet/pen/XWzKYba

It looks like there's possibly an issue with input field values in the test case above - clicking on the items in the left table sets the selectedItem property of the store, and the right panel is rendered. The heading is correct, but the 'Name' and 'Timezone' input fields remain at whatever you first clicked on.

My workaround in the production code I'm writing is to set selectedItem to 0 in the selectItem() function, call render() and then set it to what I want, which isn't ideal but works.

Using reef 11.0.1 in Chrome Version 97.0.4692.99 on Windows 10 (also tried Firefox 93.0.3)

Frenzie commented 2 years ago

Presumably the same thing seems to happen with the disabled attribute on buttons.

anthonysan95 commented 2 years ago

https://reefjs.com/advanced/#default-and-state-based-html-attributes

cferdinandi commented 2 years ago

Per the linked article, this is handled with the @ and # prefixes in your template.