fix(form): restore money conversion in createHeadlessForm when options are passed - #1429
Merged
Merged
Conversation
Portugal's extended work hours allowance is a forced money value computed from the salary. Onboarding built its render-time form without converting money fields to cents, so the allowance was computed from the salary in major units (100x too small), and the forced value was then written into the form state in cents while the form keeps money in major units. Validation recomputed the correct value and rejected the submission on a field with no input to show the error, blocking the step. - Onboarding's useJSONSchemaForm passes transformMoneyFields: true, since createHeadlessForm only defaults it on when no options are passed. - Forced money values are converted from cents before being set in the form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Default transformMoneyFields to true whenever it's not explicitly set, instead of only when the whole options object is missing. Callers that pass options without transformMoneyFields (e.g. only jsfModify) now get money fields converted to cents too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tails path The flow regression test only covers the legacy path while PRT is outside JSF_V1_CONTRACT_DETAILS_COUNTRIES. These test the Onboarding useJSONSchemaForm hook and JSONSchemaFormFields directly, so they keep covering the fix whichever countries are on v1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Submitting a forced value already uses the field's `const` in cents (parseFormValuesToAPI overwrites the form value with it), and the default forced value component doesn't render `value`. The `transformMoneyFields` change alone fixes the PRT allowance; getForcedValue would only change what custom forcedValue components receive in `fieldData.value`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
📦 Bundle Size Report
Size Limits
Largest Files (Top 5)
View All Files (75 total)
✅ Bundle size check passed |
remotecom
changed the base branch from
fix/computed-money-forced-value
to
main
September 29, 2026 20:08
Contributor
|
Deploy preview for adp-cost-calculator ready!
Deployed with vercel-action |
Contributor
|
Deploy preview for remote-flows ready!
Deployed with vercel-action |
Contributor
📊 Coverage Report✅ Coverage increased! 🎉
Detailed BreakdownLines Coverage
Statements Coverage
Functions Coverage
Branches Coverage
✅ Coverage check passed |
Correct submission of forced money values relies on parseFormValuesToAPI overwriting the form value with the field's const. Covers a top-level field and one nested in a fieldset; both fail with 100x the amount without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
createHeadlessForm now defaults transformMoneyFields per key (#1426), so the explicit override in useJSONSchemaForm is redundant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
remotecom
reviewed
Sep 29, 2026
1 of 2 tasks
3 tasks done
cammellos
approved these changes
Sep 30, 2026
2 tasks
Merged
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.
Summary
Narrows #1424 to the change that actually fixes the Portugal extended work hours allowance. The extra helper it added for forced money values isn't needed, and the money conversion fix now lives in
createHeadlessForm(from #1426) instead of a per-caller flag.Why
The allowance is a forced money value that the schema computes from the salary.
createHeadlessFormonly turnedtransformMoneyFieldson when no options object was passed at all, and Onboarding always passes one. So the schema saw the salary in major units instead of cents, and the allowance came out 100x too small (812 instead of 81257).So the
getForcedValuehelper wasn't fixing anything. What it would change is thefieldData.valuethat a partner's customforcedValuecomponent receives (major units instead of the raw value). That prop is public, so if it ever changes it should be its own decision.What changed
Toggle details
getForcedValuefromsrc/components/form/utils.ts, and its call sites inJSONSchemaForm.tsxandFieldSetField.tsx. They go back to passingconst, as onmain.src/components/form/tests/utils.test.tsandJSONSchemaFormForcedValue.test.tsx.createHeadlessFormnow defaultstransformMoneyFieldstotruefor each call unless it's set explicitly, and invoice schedules drops its now-redundant explicit flag.transformMoneyFields: trueinOnboarding/api.ts, since the new default covers it.Onboarding/api.tsis unchanged frommain.useJSONSchemaFormMoneyForcedValue.test.tsx. Both fail whencreateHeadlessFormis reverted tomain(812 instead of 81257, and "812.57 EUR" not shown), and pass with this change.contractor-contract-detailswherever they pass options together with field values. Only the Portugal Onboarding path has a test.fieldData.valueas it is onmain.Screenshots
N/A
Related Resources
Testing
useJSONSchemaFormhook test pass locally, and both fail whencreateHeadlessFormis reverted tomain🤖 Generated with Claude Code