Open aidanhs opened 5 years ago
@aidanhs Thank you for reporting!
@rail44 https://github.com/facebook/react/blob/409e472fcaae2b6c171f4e9a0c4b5ad88ec2bf21/packages/events/ReactControlledComponent.js Understand it.
Hmm. We have a simple binding for DOM such as just string base. Before wrapping DOM to implement Comtrolled Component, We must make the binding having more rich types.
See DenisKolodin/yew#233 (comment) for context.
Essentially, the desired behavior is: if an edit for a field (e.g. an input or text area) is 'rejected' (i.e. not applied to the model), the render should not update. In react this is known as 'controlled components'.
In squark you can test this by applying the patch I've pasted at the bottom and then editing the 'new item' input element on the todomvc example. Because the internal state isn't changing, arguably neither should the render. Unfortunately, it does.
React solves this by restoring state after a change event (described on the linked issue). Note that react also provides uncontrolled components where the value field is not set. I think the important thing is that both options are available (somehow).