-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[WEB-5863] fix: estimate point input validation #8492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: preview
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,3 @@ | ||||||
| import type { FC } from "react"; | ||||||
| // plane imports | ||||||
| import type { TEstimateSystemKeys } from "@plane/types"; | ||||||
| import { EEstimateSystem } from "@plane/types"; | ||||||
|
|
@@ -21,7 +20,7 @@ export function EstimateInputRoot(props: TEstimateInputRootProps) { | |||||
| case EEstimateSystem.POINTS: | ||||||
| return ( | ||||||
| <EstimateNumberInput | ||||||
| value={value ? parseInt(value) : undefined} | ||||||
| value={value ? parseFloat(value) : undefined} | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add validation to handle invalid numeric input.
Consider adding validation: 🔎 Proposed fix to validate parsed value- value={value ? parseFloat(value) : undefined}
+ value={value ? (isNaN(parseFloat(value)) ? undefined : parseFloat(value)) : undefined}Or extract to a variable for clarity: + const parsedValue = value ? parseFloat(value) : undefined;
return (
<EstimateNumberInput
- value={value ? parseFloat(value) : undefined}
+ value={parsedValue !== undefined && !isNaN(parsedValue) ? parsedValue : undefined}
handleEstimateInputValue={handleEstimateInputValue}
/>
);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| handleEstimateInputValue={handleEstimateInputValue} | ||||||
| /> | ||||||
| ); | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.