Skip to content

Conversation

@0xAlunara
Copy link
Collaborator

@0xAlunara 0xAlunara commented Oct 16, 2025

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 NumericTextField is now also slightly less complex.

  1. Prevents tiny values (e.g. 0.001) from rounding to 0 while trying to change it to 0.002 during the intermediary 0.00 step in NumericTextField.
  2. Adds a custom comparator to useUniqueDebounce to avoid unnecessary updates (0.00 → 0.0)
  3. Improves handling of partial input (-, ., empty) and temporary invalid states, mainly fixes sudden NaN and -Infinity values during typing.
  4. Always allow negative input during editing; clamps on blur. Disallowing - during typing is highly annoying.
  5. Updates tests and renames ClientWrapperComponentTestWrapper for component tests with optional wagmi config for better clarity. Turns out I need it to test LargeTokenInput as it's based on MUI.

@vercel
Copy link

vercel bot commented Oct 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
curve-dapp Ready Ready Preview Comment Oct 22, 2025 1:10pm
curve-dapp-storybook Ready Ready Preview Comment Oct 22, 2025 1:10pm

0xtutti
0xtutti previously approved these changes Oct 16, 2025
Copy link
Contributor

Copilot AI left a 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 NumericTextField by allowing temporary invalid states during typing
  • Enhanced useUniqueDebounce with custom comparators to prevent unnecessary updates
  • Updated test components to use the renamed ComponentTestWrapper for 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

0xPearce
0xPearce previously approved these changes Oct 20, 2025
Base automatically changed from refactor/numeric-text-field-amount to main October 20, 2025 09:13
@DanielSchiavini DanielSchiavini dismissed stale reviews from 0xPearce, 0xtutti, and themself October 20, 2025 09:13

The base branch was changed.

Copy link
Collaborator

@DanielSchiavini DanielSchiavini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's crashing on firefox 😞
LlamaLend Markets -- should allow filtering by token (failed)

@DanielSchiavini DanielSchiavini dismissed their stale review October 22, 2025 13:20

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)

@DanielSchiavini DanielSchiavini merged commit c8a502c into main Oct 22, 2025
16 checks passed
@DanielSchiavini DanielSchiavini deleted the fix/lti-decimals branch October 22, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants