Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inputElementConfig_initialValue doen't work after reload #409

Open
pkaterski opened this issue Nov 13, 2020 · 4 comments
Open

inputElementConfig_initialValue doen't work after reload #409

pkaterski opened this issue Nov 13, 2020 · 4 comments

Comments

@pkaterski
Copy link

I think this is a bug.
It is even present on https://reflex-frp.org/tutorial. If you open the page and look at tutorial4 and tutorial5 the first time it works as it should but after a reload the text inputs are empty (you can see that they load for a brief second and then they disappear).
Basically this thing:

  x <- inputElement $ def & inputElementConfig_initialValue .~ "input"
  dynText $ _inputElement_value x

The issue is that after reloads the value loads just for a brief second and then it disappears. I've tried it on both Chrome and Firefox.

@tomsmalley
Copy link
Member

Possibly related: #400

I can’t check that it’s fixed by that right now but this certainly rings a bell.

@MurakamiKennzo
Copy link

MurakamiKennzo commented Apr 17, 2021

Hi, I think the problem is still exist. any help?

and my code is the same as @pkaterski :

do
      el "h4" $ text "Initial Value"
      t2 <- inputElement $ def & inputElementConfig_initialValue .~ "input"
      dynText $ value t2

this is what i really want to do:

  do
      el "h4" $ text "Initial Value"
      t2 <- inputElement $ def & inputElementConfig_elementConfig . elementConfig_initialAttributes .~ ("value" =: "input") 
      -- t2 <- inputElement $ def & inputElementConfig_initialValue .~ "input"
      dynText $ value t2

I'm new here, so i may not understand the PR. Thanks!😭

@santiweight
Copy link

santiweight commented Oct 15, 2021

Just to confirm @tomsmalley - this issue is still present when using HEAD for reflex-dom. The logic is correct for loading the page for the first time, such as a direct url or link. However, when reloading the page, the issue remains the same as before - the placeholder text will flash for a second and then disappear.

The behaviour is also quite strange - I have another widget that depends on the Dynamic t Text produced by textAreaElement, and that Dynamic uses the correct initial value for a full second, but then after a good second at least, the Dynamic t Text is reset to "". Note that throughout this time, the value displayed in the textAreaElement is "". I wonder if the way text area elements work on refresh is subtly different?

@santiweight
Copy link

santiweight commented Oct 15, 2021

Apologies! This bug is actually fixed - I just made a mistake by only updating reflex-dom, but this fix is in fact spread across reflex-dom and reflex-dom-cre.

I recommend also closing #377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants