Allow decimal amount entry in CurrencyInput#5639
Merged
Conversation
Add internal display state so trailing decimals (e.g. "5.") are not stripped when the component is controlled. Move onChange notification into onValueChange to pass the resolved float and raw string consistently. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rajohnson90
approved these changes
May 8, 2026
Contributor
rajohnson90
left a comment
There was a problem hiding this comment.
Looks good to me. AI PR review passed and this passed the eye test for me as well. Tested locally and things are working
Santi-3rd
approved these changes
May 8, 2026
Contributor
|
🎉 This PR is included in version 1.383.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Fixes a bug where users could not type a decimal amount (e.g.
5.50) in anyCurrencyInputfield — the decimal point was stripped on every keystroke.Root cause:
react-currency-format'sonValueChangereturns a numericfloatValue(e.g.5, no trailing decimal). That number was stored in parent state and passed back as the controlledvalueprop, which reformatted"5."→"5"on every render, making it impossible to type cents.frontend/src/components/UI/Form/CurrencyInput/CurrencyInput.jsxdisplayValuestring state, seeded from the parentvalueprop at mountskipNextSyncRefboolean ref: set totrueon each user keystroke (onValueChange) so theuseEffectskips the parent's round-trip echo and preserves the in-progress string (e.g."5.")useEffectwatching the parentvalueprop still syncsdisplayValuefor genuine external changes (form reset, pre-fill), but skips when the ref flag is sethandleChangeabove thereturnfor readabilityfrontend/src/components/UI/Form/CurrencyInput/CurrencyInput.test.jsx(new file)setEnteredAmount, round-trip guard (both sides verified), external reset clears the inputfrontend/cypress/e2e/createAgreement.cy.js500.75, and asserts the decimal is retained in the inputIssue
#5638
How to test
Unit tests:
Expected: 4 tests pass.
Manual (requires Docker stack):
500.75500.75, not500or5E2E (requires Docker stack):
cd frontend bun run test:e2eThe new
allows entering a decimal budget line amounttest increateAgreement.cy.jsshould pass.A11y impact
Screenshots
N/A — the fix is a behavioral change (decimal entry now works), not a visual change.
Definition of Done Checklist
Links
N/A