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

fix: Update input to empty string when userValue is undefined #323

Merged
merged 7 commits into from
Dec 28, 2023

Conversation

aconrad
Copy link
Contributor

@aconrad aconrad commented Dec 20, 2023

Fixes #322.

I'm unsure if that's the correct approach, but all tests pass, including the ones I added that weren't passing before the fix.

@@ -104,9 +104,9 @@ export const CurrencyInput: FC<CurrencyInputProps> = forwardRef<
};

const formattedStateValue =
defaultValue !== undefined && defaultValue !== null
defaultValue != null
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just a clean-up. The double-equal null logic is equivalent to checking for null and undefined. It makes the code more concise.

Copy link
Owner

Choose a reason for hiding this comment

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

Interesting, I did not know that!

Although, I personally would prefer to be explicit rather than concise, so I was tempted to say keep it as is, but since all the tests passed anyway, I thought that's good enough for me :D

@aconrad aconrad changed the title fix: Write a failing test fix: Update input to empty string when userValue is undefined Dec 20, 2023
@aconrad aconrad marked this pull request as ready for review December 21, 2023 01:28
@aconrad
Copy link
Contributor Author

aconrad commented Dec 27, 2023

@cchanxzy do you have time to take a look at this PR and the issue it attempts to fix?

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (86b5634) 100.00% compared to head (1d72fdc) 100.00%.
Report is 1 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #323   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines          410       411    +1     
  Branches       161       159    -2     
=========================================
+ Hits           410       411    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cchanxzy cchanxzy merged commit 30c5fcc into cchanxzy:master Dec 28, 2023
5 checks passed
@cchanxzy
Copy link
Owner

Thanks for the contribution and fix @aconrad !

github-actions bot pushed a commit that referenced this pull request Dec 28, 2023
## [3.6.13](v3.6.12...v3.6.13) (2023-12-28)

### Bug Fixes

* Update input to empty string when `userValue` is `undefined` ([#323](#323)) ([30c5fcc](30c5fcc))
Copy link

🎉 This PR is included in version 3.6.13 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Input value doesn't update when prop value is set to undefined from an external button
3 participants