reflex-frp / reflex-dom

Web applications without callbacks or side-effects. Reflex-DOM brings the power of functional reactive programming (FRP) to the web. Build HTML and other Document Object Model (DOM) data with a pure functional interface.
https://reflex-frp.org
BSD 3-Clause "New" or "Revised" License
357 stars 146 forks source link

textAreaElementConfig_initialValue has no effect #377

Closed srid closed 1 year ago

srid commented 4 years ago

Here's the code that defines the textarea element:

https://github.com/srid/MarkdownPreview/blob/89ec7c2fb2206f01219709f86c29fd53f12e8218/frontend/src/Frontend.hs#L34-L38

To reproduce, clone this repo (at commit 89ec7c2 if it matters), and run ob run. You will notice that the app loads with an empty textbox, instead of being initialized with Hello *world*.

anfelor commented 4 years ago

This is quite common. In fact, even adding

      textAreaElement $ def & textAreaElementConfig_initialValue .~ "some value"

to the project generated by ob init will reproduce this error.

anfelor commented 4 years ago

It could be related to the fact, that this code uses TextArea.setValue which was auto-generated and looks fishy because textarea actually has no value attribute. But then the setValue functionality of reflex-dom textareas works as expected and also uses TextArea.setValue..

tomsmalley commented 4 years ago

This is quite possibly fixed by https://github.com/reflex-frp/reflex-dom/pull/400

anfelor commented 4 years ago

@tomsmalley That seems like it should fix the issue. TextArea.setValue doesn't seem to be the culprit since it sets the value by javascript internally and that is possible.