-
-
Notifications
You must be signed in to change notification settings - Fork 924
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
<input value={undefined}> shows string "undefined" #1041
Comments
It's only going to be the short list of properties I choose to handle as properties for performance. I just double-checked and it's I think if there is a good reason for a The solution is to initialize to an empty string. It is so much better if we can just not do anything here as it is so easy to mitigate and the solution puts a size and perf tax on everyone. But if there was more reason to go this way definitely do it. |
Agreed; I expect a type error when setting value to undefined, so it seems fine to leave this behavior, provided we document and perhaps help avoid it.
|
I just encountered this after updating an older project. Curious when this behaviour changed as it didn't seem to happen before? |
Always been like this. This is an example where we'd need to do more work to prevent it. |
seems to be done in ryansolid/dom-expressions@e69bf27 ( |
Describe the bug
This is a sequel to #955, where the same issue occurred with
class
/className
.compiles to
Because of the infinite wisdom of the DOM
.value
interface, this causes the value to be set to the string"undefined"
. 🙁Reported on Discord
Your Example Website or App
https://playground.solidjs.com/?hash=-335339517&version=1.4.1
Steps to Reproduce the Bug or Issue
Expected behavior
I'm not sure there's a clear expectation here, but I probably expected a blank input, with the intuition that
attr={undefined}
is equivalent to omittingattr
altogether. Instead I'm seeing the string "undefined" in the input.Screenshots or Videos
Platform
Additional context
FWIW, here's a CodeSandbox showing that
value={undefined}
renders blank in React.Is it worth reviewing for other DOM interfaces like these?
The text was updated successfully, but these errors were encountered: