Skip to content

fix(money) - parse values before prettifying#1001

Merged
gabrielseco merged 10 commits intomainfrom
fix-prettify-money-values
May 8, 2026
Merged

fix(money) - parse values before prettifying#1001
gabrielseco merged 10 commits intomainfrom
fix-prettify-money-values

Conversation

@gabrielseco
Copy link
Copy Markdown
Collaborator

@gabrielseco gabrielseco commented May 6, 2026

The problem

When users use the onboarding for Belgium, the contract details has some fields like eco_voucher and yearly premium rendered incorrectly

image

The solution

The solution is to pass to prettifyFormValues in the onSubmit, the values already parsed and that way in prettifyFormValues we can convert always trusting that the input will be always in cents

the problem was the values of the form was mixing cents && normal values in different inputs

We builld a escape hatch when we call prettifyFormValues when an employee has been invited

https://www.loom.com/share/2efa29079483435f8c160faef9a7ba81

Note

Medium Risk
Touches shared form value transformation and review metadata rendering, which can affect how money amounts and some field values are displayed across multiple flows. Main risk is incorrect unit conversion (cents vs. major units) in review screens or tests if any step bypasses the new parsing/prettifying order.

Overview
Review metadata now uses parsed values (API-shaped) when calling prettifyFormValues in Onboarding, ContractorOnboarding, CreateCompany, and CostCalculator, preventing mismatches between what is submitted and what is shown in the review/meta UI.

Money prettification is corrected: prettifyFormValues now converts money values from cents via convertFromCents, supports null, and adds an option skipMoneyConversion used when building review metadata from initial (already-normalized) values during auto-navigation to review.

UI/test updates: review step rendering is adjusted to hide empty engagement_agreement_details, introduces a shared PrettifiedValuesRenderer for tests, and adds/updates tests to assert correct money display in review (including direct-to-review invited employments).

Reviewed by Cursor Bugbot for commit e368313. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 211.12 kB 211.94 kB -821 B (-0.4%) 🟢
Total (raw) 570.92 kB 572.97 kB -2.05 kB (-0.4%) 🟢
CSS (gzip) 20.69 kB 20.69 kB 0 B (0%) 🟢
CSS (raw) 107.95 kB 107.95 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 211.12 kB / 250 kB (84.4%)
  • ✅ Total raw: 570.92 kB / 600 kB (95.2%)
  • ✅ CSS gzipped: 20.69 kB / 25 kB (82.8%)

Largest Files (Top 5)

  1. chunk-XG6ASTX5.js - 14 kB (new)
  2. styles.css - 10.35 kB (0 B (0%))
  3. index.css - 10.35 kB (0 B (0%))
  4. index.js - 6.06 kB (-22 B (-0.4%))
  5. chunk-TNQKP2XT.js - 5.89 kB (0 B (0%))
View All Files (312 total)
File Size (gzip) Change
chunk-XG6ASTX5.js 14 kB new
styles.css 10.35 kB 0 B (0%)
index.css 10.35 kB 0 B (0%)
index.js 6.06 kB -22 B (-0.4%)
chunk-TNQKP2XT.js 5.89 kB 0 B (0%)
chunk-N6OHWIQ4.js 5.81 kB new
chunk-RZCU2MT3.js 5.23 kB new
chunk-WUSKSXW2.js 4.62 kB new
chunk-MGQ6766I.js 4.29 kB new
chunk-QYNWADPG.js 4.06 kB new

✅ Bundle size check passed

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

📊 Coverage Report

✅ Coverage increased! 🎉

Metric Current Previous Change Status
Lines 90.02% 90.00% +0.01% 🟢
Statements 89.69% 89.68% +0.01% 🟢
Functions 87.68% 87.70% -0.02% 🔴
Branches 80.06% 80.00% +0.06% 🟢

Detailed Breakdown

Lines Coverage
  • Covered: 3671 / 4078
  • Coverage: 90.02%
  • Change: +0.01% (-3 lines)
Statements Coverage
  • Covered: 3732 / 4161
  • Coverage: 89.69%
  • Change: +0.01% (-3 statements)
Functions Coverage
  • Covered: 996 / 1136
  • Coverage: 87.68%
  • Change: -0.02% (-2 functions)
Branches Coverage
  • Covered: 2272 / 2838
  • Coverage: 80.06%
  • Change: +0.06% (4 branches)

✅ Coverage check passed

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-oy2yls3eh-remotecom.vercel.app
Latest Commit:e368313
Inspect:View deployment

Deployed with vercel-action

@gabrielseco gabrielseco marked this pull request as ready for review May 6, 2026 08:33
Comment thread src/lib/utils.ts
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 49f0df8. Configure here.

Comment thread src/lib/utils.ts
Comment thread example/src/ReviewOnboardingStep.tsx
Comment thread src/components/form/utils.ts
Comment thread src/flows/ContractorOnboarding/tests/ContractorOnboarding.test.tsx
Comment thread src/flows/ContractorOnboarding/hooks.tsx
Comment thread src/flows/ContractorOnboarding/hooks.tsx
Comment thread src/flows/CostCalculator/CostCalculatorForm.tsx
Comment thread src/flows/Onboarding/tests/OnboardingFlow.test.tsx
@gabrielseco gabrielseco merged commit a9eda9e into main May 8, 2026
10 checks passed
@gabrielseco gabrielseco deleted the fix-prettify-money-values branch May 8, 2026 08:04
@gabrielseco gabrielseco mentioned this pull request May 8, 2026
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.

2 participants