refactor: slippage tolerance form#5676
Conversation
🦋 Changeset detectedLatest commit: 997557f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR refactors the swap slippage tolerance form. The main changes are:
Confidence Score: 4/5The changed slippage input path needs a small fix before merging.
apps/evm/src/containers/SwapDetails/index.tsx and apps/evm/src/store/index.ts Important Files Changed
Reviews (1): Last reviewed commit: "refactor: slippage tolerance form" | Re-trigger Greptile |
| if (validateSlippageTolerancePercentage(value)) { | ||
| setUserChainSettings({ | ||
| slippageTolerancePercentage: value, | ||
| slippageTolerancePercentage: Number.parseFloat(value).toString(), |
There was a problem hiding this comment.
Exponent Slippage Is Misstored
When the number input emits exponent notation like 1e1, validation accepts it as 10%, but this line stores 1 because parseFloat stops before the exponent. The modal accepts the user's value, while later swap quotes use a different slippage tolerance.
| slippageTolerancePercentage: Number.parseFloat(value).toString(), | |
| slippageTolerancePercentage: Number(value).toString(), |
Context Used: AGENTS.md (source)
| slippageTolerancePercentage: isSlippageTolerancePercentageValid | ||
| ? settings.slippageTolerancePercentage | ||
| : String(DEFAULT_SLIPPAGE_TOLERANCE_PERCENTAGE), |
There was a problem hiding this comment.
If an older persisted setting or manually restored state has slippageTolerancePercentage as a JSON number, the migration validates it but writes the original number back into a field typed and initialized as a string. That value then reaches the React Hook Form default for the modal, so consumers can receive a shape that no longer matches UserChainSettings.
| slippageTolerancePercentage: isSlippageTolerancePercentageValid | |
| ? settings.slippageTolerancePercentage | |
| : String(DEFAULT_SLIPPAGE_TOLERANCE_PERCENTAGE), | |
| slippageTolerancePercentage: isSlippageTolerancePercentageValid | |
| ? String(settings.slippageTolerancePercentage) | |
| : String(DEFAULT_SLIPPAGE_TOLERANCE_PERCENTAGE), |
Context Used: AGENTS.md (source)
Coverage Report for ./apps/evm
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
997557f to
ee031f2
Compare
Changes