fix: preserve fixed decimals in currency input setValue#41740
fix: preserve fixed decimals in currency input setValue#41740atharvasingh7007 wants to merge 1 commit intoappsmithorg:releasefrom
Conversation
WalkthroughThis change adds a helper function Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/client/src/widgets/wds/WDSCurrencyInputWidget/config/propertyPaneConfig/validations/defaultValueValidation.ts (1)
36-50: Consider extractinggetParsedStringto a shared utility.This helper is duplicated in
app/client/src/widgets/CurrencyInputWidget/widget/index.tsx(lines 80-94). Theutilities.tsfiles in both widget directories already contain related decimal-handling functions likelimitDecimalValue. Moving this helper there would reduce duplication.Not blocking for this bug fix—can be addressed in a follow-up.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/client/src/widgets/wds/WDSCurrencyInputWidget/config/propertyPaneConfig/validations/defaultValueValidation.ts` around lines 36 - 50, getParsedString is duplicated and should be extracted to a shared utility: move the getParsedString implementation (which depends on defaultDecimalSeperator and converts a numeric parsedValue to a string preserving fractional length) into an existing shared utility module alongside functions like limitDecimalValue, export it, and replace the local definitions in both getParsedString usages (in defaultValueValidation.ts and CurrencyInputWidget widget/index.tsx) with imports from that utility to remove duplication.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@app/client/src/widgets/wds/WDSCurrencyInputWidget/config/propertyPaneConfig/validations/defaultValueValidation.ts`:
- Around line 36-50: getParsedString is duplicated and should be extracted to a
shared utility: move the getParsedString implementation (which depends on
defaultDecimalSeperator and converts a numeric parsedValue to a string
preserving fractional length) into an existing shared utility module alongside
functions like limitDecimalValue, export it, and replace the local definitions
in both getParsedString usages (in defaultValueValidation.ts and
CurrencyInputWidget widget/index.tsx) with imports from that utility to remove
duplication.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ca3b8fb5-7da2-4c9f-a5a6-cb78d9dc1a89
📒 Files selected for processing (4)
app/client/src/widgets/CurrencyInputWidget/widget/index.test.tsxapp/client/src/widgets/CurrencyInputWidget/widget/index.tsxapp/client/src/widgets/wds/WDSCurrencyInputWidget/config/propertyPaneConfig/validations/defaultValueValidation.tsapp/client/src/widgets/wds/WDSCurrencyInputWidget/widget/index.test.tsx
Summary
Closes #41118.
Testing
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests