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

Prevents error if sl-input has value undefined #513

Merged
merged 1 commit into from
Aug 30, 2021

Conversation

sidharthramesh
Copy link
Contributor

@sidharthramesh sidharthramesh commented Aug 28, 2021

The sl-input's value state being undefined is very common when using shoelace with frameworks. Instead of erroring out and not showing the input, this should handle it gracefully. Fixes #514 .

The sl-input's value state being `undefined` is very common when using shoelace with frameworks. Instead of erroring out and not showing the input, this should handle it gracefully.
@vercel
Copy link

vercel bot commented Aug 28, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/shoelace/shoelace/CFGgms4cXdHjNn8QKHWaDZSCT39c
✅ Preview: https://shoelace-git-fork-sidharthramesh-patch-1-shoelace.vercel.app

@claviska
Copy link
Member

You really shouldn't set an input's value to undefined, you should use an empty string or null, otherwise you'll end up with:

CleanShot 2021-08-30 at 08 21 51@2x

However, this is the same behavior as <input> so I'll accept the PR and carry the same changes over to other form controls to guard against errors.

Copy link
Member

@claviska claviska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepting this PR with the intent to bring the same changes to other form controls.

@claviska claviska merged commit da3415d into shoelace-style:next Aug 30, 2021
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

Successfully merging this pull request may close these issues.

sl-input errors out when value=undefined
2 participants