-
Couldn't load subscription status.
- Fork 45
fix: various fixes and improvements to numeric text field and large token input #1528
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Pull Request Overview
This PR fixes a bug in numeric input handling where tiny values (e.g. 0.001) would round to 0 during intermediate typing states, and improves the overall robustness of numeric input components. The changes enhance the NumericTextField and LargeTokenInput components to better handle partial input states and prevent unnecessary updates.
Key changes:
- Fixed rounding issues in
NumericTextFieldby allowing temporary invalid states during typing - Enhanced
useUniqueDebouncewith custom comparators to prevent unnecessary updates - Updated test components to use the renamed
ComponentTestWrapperfor better clarity
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/cypress/support/helpers/ComponentTestWrapper.tsx | Renamed from ClientWrapper and made wagmi config optional for flexible testing |
| tests/cypress/component/numeric-text-field.cy.tsx | Enhanced test coverage with new scenarios for decimal handling and temporary states |
| tests/cypress/component/loan/peg-stability-reserve.rpc.cy.tsx | Updated import to use renamed ComponentTestWrapper |
| tests/cypress/component/llamalend/borrow-tab-contents.rpc.cy.tsx | Updated import to use renamed ComponentTestWrapper |
| tests/cypress/component/large-token-input.cy.tsx | New test file for LargeTokenInput component |
| packages/curve-ui-kit/src/shared/ui/TradingSlider.tsx | Added validation to prevent NaN values in percentage changes |
| packages/curve-ui-kit/src/shared/ui/SearchField.tsx | Updated to use new useUniqueDebounce API with custom comparator |
| packages/curve-ui-kit/src/shared/ui/NumericTextField.tsx | Major refactor to handle temporary invalid states and prevent premature rounding |
| packages/curve-ui-kit/src/shared/ui/LargeTokenInput.tsx | Updated to handle string-based temporary values and prevent debounce cancellation |
| packages/curve-ui-kit/src/hooks/useDebounce.ts | Enhanced useUniqueDebounce with custom equality comparator and cancel functionality |
| apps/main/src/llamalend/features/market-list/filters/RangeSliderFilter.tsx | Updated to use new useUniqueDebounce API structure |
The base branch was changed.
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.
I cannot reproduce the error anymore. That might have been fixed since major changes were done to the token selector in the main branch (mainly in #1505)

Depends on #1524. I've also added the commits of another would-be PR into this as it would change things even more and I want to avoid review comments on things that will change anyway. Aside from bug fixes I think the
NumericTextFieldis now also slightly less complex.NumericTextField.useUniqueDebounceto avoid unnecessary updates (0.00 → 0.0)-,., empty) and temporary invalid states, mainly fixes suddenNaNand-Infinityvalues during typing.ClientWrapper→ComponentTestWrapperfor component tests with optional wagmi config for better clarity. Turns out I need it to testLargeTokenInputas it's based on MUI.