Skip to content

fix: use useFormState to read RHF state#5677

Merged
therealemjy merged 1 commit into
mainfrom
fix/vault-forms
Jul 8, 2026
Merged

fix: use useFormState to read RHF state#5677
therealemjy merged 1 commit into
mainfrom
fix/vault-forms

Conversation

@therealemjy

@therealemjy therealemjy commented Jul 7, 2026

Copy link
Copy Markdown
Member

Changes

  • use useFormState to read RHF state
  • fix revoke button of spending limit component

@therealemjy therealemjy requested a review from cuzz-venus July 7, 2026 17:48
@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a675895

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

vercel Bot commented Jul 7, 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 Jul 7, 2026 5:57pm
dapp-testnet Ready Ready Preview Jul 7, 2026 5:57pm
venus.io Ready Ready Preview Jul 7, 2026 5:57pm

Request Review

@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown

Greptile Summary

This PR changes form state reads to use React Hook Form subscriptions. The main changes are:

  • Several EVM forms now read errors, isValid, isSubmitting, and related state through useFormState.
  • The Prime Calculator form narrows one effect dependency to the dirty state it checks.
  • The SpendingLimit revoke icon now renders through the shared Icon component.
  • A patch changeset was added for @venusprotocol/evm.

Confidence Score: 5/5

The changed flow looks mergeable after restoring the revoke button label.

  • The form state migration uses RHF controls already available in each changed form.
  • The main follow-up is the unlabeled destructive revoke icon.
  • No blocking transaction, validation, build, or security issue was found in the changed code.

apps/evm/src/components/SpendingLimit/index.tsx

Important Files Changed

Filename Overview
apps/evm/src/components/SpendingLimit/index.tsx Replaces the revoke InfoIcon with Icon, which keeps the bin icon but drops the translated tooltip label.
apps/evm/src/containers/VaultForm/index.tsx Reads submit and validity state with useFormState from the passed RHF form control.
apps/evm/src/pages/Bridge/index.tsx Reads bridge form errors, dirty state, submitting state, and validity through useFormState.
apps/evm/src/pages/PrimeCalculator/Form/index.tsx Reads dirty and validation state through useFormState and narrows the initialization effect dependency.
apps/evm/src/pages/Vai/Borrow/index.tsx Reads VAI borrow form errors through useFormState from the custom hook’s RHF control.
apps/evm/src/pages/Vai/Repay/index.tsx Reads VAI repay form errors through useFormState for the full-repayment warning.
.changeset/young-rooms-fry.md Adds a patch changeset for the EVM package.

Reviews (1): Last reviewed commit: "fix: use useFormState to read RHF state" | Re-trigger Greptile

Comment on lines 68 to 72
<TextButton onClick={handleRevoke} className="text-red ml-2 h-auto p-0">
<InfoIcon
iconName="bin"
iconClassName="text-red h-5 w-5 transition-opacity hover:opacity-50 active:opacity-50"
tooltip={t('spendingLimit.revokeButtonTooltip')}
className="inline-flex"
<Icon
name="bin"
className="text-red h-5 w-5 transition-opacity hover:opacity-50 active:opacity-50"
/>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Revoke Button Loses Label

When the spending-limit row renders the revoke action, the changed button now contains only a bare Icon. The previous InfoIcon supplied the translated “Revoke spending limit” tooltip on hover, focus, and mobile tap, so this destructive icon button now has no visible or accessible explanation before users activate it.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's expected, we don't want a tooltip here.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./apps/evm

Status Category Percentage Covered / Total
🔵 Lines 82.29% 50177 / 60973
🔵 Statements 82.29% 50177 / 60973
🔵 Functions 62.01% 671 / 1082
🔵 Branches 73.02% 5704 / 7811
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/evm/src/components/SpendingLimit/index.tsx 94.44% 72.72% 100% 94.44% 36-37, 65
apps/evm/src/containers/VaultForm/index.tsx 94.83% 93.18% 75% 94.83% 178-187, 213-214
apps/evm/src/pages/Bridge/index.tsx 91.64% 84.28% 81.81% 91.64% 80, 134-135, 166-168, 174-186, 212-214, 240-242, 249-252, 281, 344-346
apps/evm/src/pages/PrimeCalculator/Form/index.tsx 95.96% 83.13% 100% 95.96% 71, 75, 228-229, 232-245, 316
apps/evm/src/pages/Vai/Borrow/index.tsx 95.1% 83.72% 100% 95.1% 62, 84-85, 100, 110, 199-203, 220-221
apps/evm/src/pages/Vai/Repay/index.tsx 94.58% 52.94% 100% 94.58% 60-61, 128-132, 155-156, 164-166
Generated in workflow #13775 for commit a675895 by the Vitest Coverage Report Action

@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

@therealemjy therealemjy merged commit 80f536d into main Jul 8, 2026
5 checks passed
@therealemjy therealemjy deleted the fix/vault-forms branch July 8, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants