Skip to content

[EuiFieldNumber] Add string as valid value type#3020

Merged
thompsongl merged 7 commits intomasterfrom
add-string-as-value-type
Mar 10, 2020
Merged

[EuiFieldNumber] Add string as valid value type#3020
thompsongl merged 7 commits intomasterfrom
add-string-as-value-type

Conversation

@sorenlouv
Copy link
Member

@sorenlouv sorenlouv commented Mar 9, 2020

This PR adds string as a type for value in the EuiFieldNumber component.

Reasoning
There's nothing wrong with supplying a serialized number (eg. "40") to an input field, since it'll be serialized anyway. When the onChange handler is called e.target.value will likewise be of type string regardless what the input type was.

This will remove the need for serializing/deserializing numbers when working with EuiFieldNumber

Impact
This won't change much, other than removing an error in the console when supplying a string:
image

@sorenlouv sorenlouv requested a review from thompsongl March 9, 2020 23:27
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3020/

sorenlouv and others added 2 commits March 10, 2020 19:34
@sorenlouv
Copy link
Member Author

@dimitropoulos @thompsongl Done! :)

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3020/

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

Thanks, @sqren!

Can you please add a changelog entry for this?

@sorenlouv sorenlouv requested a review from thompsongl March 10, 2020 20:48
@sorenlouv
Copy link
Member Author

@thompsongl I added it as a bug fix. Not sure if that's the right classification. LMK if I should change it.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3020/

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.

4 participants