-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
fix: Limit amount of decimals on spending cap modal #27672
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
@@ -116,10 +128,17 @@ export const EditSpendingCapModal = ({ | |||
setCustomSpendingCapInputValue(formattedSpendingCap.toString()); | |||
}, [customSpendingCapInputValue, formattedSpendingCap]); | |||
|
|||
const showDecimalError = useMemo(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, do we need a memo for this as some basic math will have negligible performance cost?
return ( | ||
<Modal | ||
isOpen={isOpenEditSpendingCapModal} | ||
onClose={() => setIsOpenEditSpendingCapModal(false)} | ||
onClose={() => handleCancel()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, no need for the lambda since handleCancel
is already a function reference with no arguments?
5039147
to
a62e734
Compare
Builds ready [a62e734]
Page Load Metrics (1832 ± 78 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
a62e734
to
4255182
Compare
Builds ready [4255182]
Page Load Metrics (1932 ± 124 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
...ons/components/confirm/info/approve/edit-spending-cap-modal/edit-spending-cap-modal.test.tsx
Outdated
Show resolved
Hide resolved
const decimalDigits = numberString.length - decimalPointIndex - 1; | ||
|
||
return decimalDigits; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return numberString.split(".")[1].length || 0;
264c806
to
1049573
Compare
1049573
to
0764d25
Compare
Quality Gate passedIssues Measures |
Builds ready [0764d25]
Page Load Metrics (1795 ± 53 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
comments were addressed
Description
If the user tries to add more decimals to the spending cap than what the token supports, the spending cap cannot be submitted and a notice is displayed.
Related issues
Fixes: #27618
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist