Skip to content

feat: vai error show#5605

Merged
cuzz-venus merged 4 commits into
mainfrom
feat/vai-error-show
Jun 1, 2026
Merged

feat: vai error show#5605
cuzz-venus merged 4 commits into
mainfrom
feat/vai-error-show

Conversation

@cuzz-venus
Copy link
Copy Markdown
Contributor

@cuzz-venus cuzz-venus commented May 27, 2026

Jira ticket(s)

VPD-1256

Changes

  • remove description

before:
image

after:

image

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

🦋 Changeset detected

Latest commit: 290bf4b

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

@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

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

Project Deployment Actions Updated (UTC)
dapp-preview Ready Ready Preview May 31, 2026 3:55pm
dapp-testnet Ready Ready Preview May 31, 2026 3:55pm
venus.io Ready Ready Preview May 31, 2026 3:55pm

Request Review

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 27, 2026

Greptile Summary

This PR refactors error handling in the VAI Borrow and Repay forms by moving translated error messages directly into the Zod schema refinements (via t() in useForm), and removing the separate NoticeError components and errorMessage useMemo blocks that previously translated raw ErrorCode enum values.

  • Borrow & Repay useForm: ErrorCode enum entries are replaced with inline t() calls inside Zod .refine() messages; t (and vai where vai.symbol is used) are added to the useMemo dependency array so the schema rebuilds on locale change.
  • Borrow & Repay page components: The errorMessage useMemo and <NoticeError> blocks are removed; errors are now surfaced inline below the amount input via RhfTokenTextField's existing fieldState.error.message display.
  • Repay page: The isRepayingFullLoan warning guard is updated from !errorMessage to !formState.errors.amountTokens, preserving the original intent.

Confidence Score: 5/5

Safe to merge — the change removes redundant UI components and consolidates error display into the existing inline mechanism without altering any business logic.

The translated strings are now computed at schema-build time and correctly keyed on t and vai in the dependency arrays, so locale changes trigger schema rebuilds as expected. RhfTokenTextField was already rendering fieldState.error.message as red text inline before this PR, so removing the external NoticeError components does not regress any error visibility.

No files require special attention.

Important Files Changed

Filename Overview
apps/evm/src/pages/Vai/Borrow/useForm/index.ts Moves error translation into the Zod schema refinements using t(), adds t to the useMemo dependency array, removes now-unused ErrorCode enum entries
apps/evm/src/pages/Vai/Borrow/index.tsx Removes the errorMessage useMemo and the NoticeError component; error display now handled inline by RhfTokenTextField's built-in fieldState.error.message rendering
apps/evm/src/pages/Vai/Repay/useForm/index.ts Same pattern as Borrow — translates error messages at schema-build time, removes ErrorCode enum, adds t and vai to the dependency array
apps/evm/src/pages/Vai/Repay/index.tsx Removes errorMessage useMemo and NoticeError; fixes the full-repayment warning guard to check formState.errors.amountTokens directly instead of the now-removed errorMessage
.changeset/fast-drinks-stop.md Patch changeset entry for the VAI error message refactor

Reviews (3): Last reviewed commit: "feat: remove raw translate key" | Re-trigger Greptile

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

Coverage Report for ./apps/evm

Status Category Percentage Covered / Total
🔵 Lines 81.31% 45799 / 56324
🔵 Statements 81.31% 45799 / 56324
🔵 Functions 62.21% 647 / 1040
🔵 Branches 72.26% 5155 / 7133
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/evm/src/pages/Vai/Borrow/index.tsx 95.08% 84.09% 100% 95.08% 62, 85-86, 101, 111, 199-203, 220-221
apps/evm/src/pages/Vai/Borrow/useForm/index.ts 99% 95% 100% 99% 1
apps/evm/src/pages/Vai/Repay/index.tsx 94.52% 52.94% 100% 94.52% 60-61, 127-131, 154-155, 163-165
apps/evm/src/pages/Vai/Repay/useForm/index.ts 97.46% 77.77% 100% 97.46% 1, 38
Generated in workflow #13531 for commit 290bf4b by the Vitest Coverage Report Action

@cuzz-venus
Copy link
Copy Markdown
Contributor Author

@greptile review again

@cuzz-venus cuzz-venus requested a review from therealemjy May 28, 2026 06:29
Comment thread apps/evm/src/pages/Vai/Borrow/index.tsx Outdated
@cuzz-venus cuzz-venus changed the title Feat/vai error show feat: vai error show May 31, 2026
@cuzz-venus
Copy link
Copy Markdown
Contributor Author

@greptile review again

Copy link
Copy Markdown
Member

@therealemjy therealemjy left a comment

Choose a reason for hiding this comment

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

Nice

@cuzz-venus cuzz-venus merged commit fffad93 into main Jun 1, 2026
5 checks passed
@cuzz-venus cuzz-venus deleted the feat/vai-error-show branch June 1, 2026 08:22
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