Skip to content

Conversation

ErvinSabic
Copy link
Contributor

Used some of @simonihmig 's suggestions along with accounted for NaN or blank values defaulting to zero.

Copy link

changeset-bot bot commented Apr 22, 2025

⚠️ No Changeset found

Latest commit: b82cb2b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@simonihmig simonihmig left a comment

Choose a reason for hiding this comment

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

Looking good, thanks @ErvinSabic! But we would need some test for this. @averydev had one already here, linked in #468.

Also just merged #550, so if you could rebase this should give us a green build (ignoring the known docs deployment issue)

}
// This is here to avoid setting the value as NaN, instead using Zero.
else if(e.target.value === "" || isNaN(valueAsNumber)){
this.args.setValue(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not quite sure about this one. Can you explain your rationale for this case?

Wouldn't not setting the value here be more appropriate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's a video explaining my thinking -

zerodefault.mp4

Copy link
Contributor Author

@ErvinSabic ErvinSabic May 13, 2025

Choose a reason for hiding this comment

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

Defaulting to a zero is simpler than maintaining the last valid state like I do on my intl number input. Number inputs should always be numbers.

@ErvinSabic
Copy link
Contributor Author

I just went ahead and pulled the latest from the base branch, added a variation of the test you'd given along with an extra. Should test and merge in green now.

@ErvinSabic
Copy link
Contributor Author

Something seems to be going on with prettier in the linting process?

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.

3 participants