fix bug in isNullOrWhiteSpace utility#3943
Conversation
WalkthroughUpdates numeric parsing in NumberFieldComponent for high-precision mode to parse strings with parseFloat and leave non-strings unchanged. Adjusts isNullOrWhiteSpace to only trim when the value is a string, avoiding trim calls on non-strings. No public API changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UI as NumberFieldComponent
participant Util as nullables.ts
User->>UI: Type input (string/number)
UI->>UI: highPrecision?
alt highPrecision enabled
alt input is string
UI->>UI: value = parseFloat(input)
else input is non-string
UI->>UI: value = input (unchanged)
end
else highPrecision disabled
UI->>UI: (existing path, unchanged)
end
UI->>Util: isNullOrWhiteSpace(value)
Note right of Util: Trim only if typeof value === "string"
Util-->>UI: boolean
UI-->>User: Update state/propagate onChange
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (2)shesha-reactjs/src/utils/nullables.ts (1)
shesha-reactjs/src/designer-components/numberField/numberField.tsx (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (2)
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 |
Summary by CodeRabbit