Skip to content

fix: display swap quote missing error#5647

Open
therealemjy wants to merge 1 commit into
mainfrom
fix/no-swap-quote
Open

fix: display swap quote missing error#5647
therealemjy wants to merge 1 commit into
mainfrom
fix/no-swap-quote

Conversation

@therealemjy

Copy link
Copy Markdown
Member

Changes

  • display "No swap found" error on Repay with collateral form

@therealemjy therealemjy requested a review from cuzz-venus June 17, 2026 11:58
@therealemjy therealemjy marked this pull request as ready for review June 17, 2026 11:59
@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
dapp-preview Ready Ready Preview Jun 17, 2026 12:00pm
dapp-testnet Ready Ready Preview Jun 17, 2026 12:00pm
venus.io Ready Ready Preview Jun 17, 2026 12:00pm

Request Review

@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eb750ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@venusprotocol/evm Patch

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

@cuzz-venus cuzz-venus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a silent error-display regression in the "Repay with collateral" form where NO_SWAP_QUOTE_FOUND was never surfaced to the user. Because repaidAmountTokens is a derived value (populated from the swap quote), it stays empty when a swap route cannot be found, causing EMPTY_TOKEN_AMOUNT to be pushed first. Since formErrors[0] is the only error shown (index.tsx line 279) and EMPTY_TOKEN_AMOUNT is explicitly excluded from the error display (formError.code !== 'EMPTY_TOKEN_AMOUNT'), the meaningful "No swap found" message was silently swallowed.

  • Moves the NO_SWAP_QUOTE_FOUND check before EMPTY_TOKEN_AMOUNT in useFormValidation.ts so the more informative error wins when both conditions are simultaneously true.
  • No logic changes other than evaluation order; the BoostForm deliberately keeps the opposite order because its single amount field is always user-controlled and the two errors are mutually exclusive there.

Confidence Score: 5/5

Safe to merge — the change is a two-check reorder within a pure useMemo with no side effects.

The reordering correctly fixes the scenario where both NO_SWAP_QUOTE_FOUND and EMPTY_TOKEN_AMOUNT are simultaneously true (derived repaidAmountTokens is empty when a swap route is unavailable). Moving NO_SWAP_QUOTE_FOUND first ensures the actionable error message surfaces. The fix is consistent with how formErrors[0] is consumed in the parent component and does not affect any other form validation paths.

No files require special attention.

Important Files Changed

Filename Overview
apps/evm/src/pages/Market/OperationForm/Repay/RepayWithCollateralForm/useForm/useFormValidation.ts Reorders error checks so NO_SWAP_QUOTE_FOUND is pushed before EMPTY_TOKEN_AMOUNT, ensuring the "No swap found" error surfaces as formErrors[0] when both conditions are true (user-entered collateral amount but derived repaidAmountTokens is empty due to failed swap).
.changeset/common-rabbits-rule.md Changeset entry correctly categorises the fix as a patch for the evm package.

Reviews (1): Last reviewed commit: "fix: display swap quote missing error" | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for ./apps/evm

Status Category Percentage Covered / Total
🔵 Lines 81.46% 47471 / 58274
🔵 Statements 81.46% 47471 / 58274
🔵 Functions 62.2% 655 / 1053
🔵 Branches 72.96% 5413 / 7419
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/evm/src/pages/Market/OperationForm/Repay/RepayWithCollateralForm/useForm/useFormValidation.ts 99.07% 96.55% 100% 99.07% 1
Generated in workflow #13662 for commit eb750ab by the Vitest Coverage Report Action

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.

2 participants