-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
BUG with style={{display:undefined}} #853
Comments
Is this a bug because the same thing presumably works in React? Using this If it's something that needs to be fixed, I imagine updating this line to add a check if the style prop is |
Strange bug. It seems like |
Confirmed, this is just a weird detail of how the style property works: |
Yep! But it should be fixed because the view should be a pure function of the state and props. |
Agreed, definitely on the to-do list. |
Good news: This issue is fixed in Preact X. I can't reproduce it anymore 🎉 |
display:undefined should not apply any style to the element, and yet it does.
Minimal example here:
https://preactjs.com/repl?code=export%20default%20class%20TodoList%20extends%20Component%20%7B%0A%20%20%20%20state%20%3D%20%7B%20visible%20%3A%20true%20%7D%3B%0A%0A%20%20%20%20render(%7B%20%7D%2C%20%7B%20todos%2C%20text%20%7D)%20%7B%0A%20%20%20%20%20%20%20%20return%20(%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cdiv%3E%0A%09%09%09%09The%20following%20texte%20should%20be%20%7Bthis.state.visible%20%3F%20%27Visible%27%3A%27Hidden%27%7D%0A%09%09%09%09%3Cbr%2F%3E%0A%09%09%09%09%3Cspan%20style%3D%7B%7Bdisplay%3Athis.state.visible%20%3F%20undefined%20%3A%20%27none%27%7D%7D%3EHello%20There!%3C%2Fspan%3E%0A%09%09%09%09%3Cbr%2F%3E%0A%09%09%09%09%3Ca%20href%3D%22%23%22%20onClick%3D%7B(event)%3D%3Ethis.setState(%7Bvisible%3A!this.state.visible%7D)%7D%3EToggle%3C%2Fa%3E%20(click%20me%20multiple%20times)%0A%09%09%09%09%3C%2Fdiv%3E%0A%20%20%20%20%20%20%20%20)%3B%0A%20%20%20%20%7D%0A%7D%0A
The text was updated successfully, but these errors were encountered: