feat: vai error show#5605
Conversation
🦋 Changeset detectedLatest commit: 290bf4b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR refactors error handling in the VAI Borrow and Repay forms by moving translated error messages directly into the Zod schema refinements (via
Confidence Score: 5/5Safe 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 No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "feat: remove raw translate key" | Re-trigger Greptile |
Coverage Report for ./apps/evm
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@greptile review again |
| name="amountTokens" | ||
| rules={{ required: true }} | ||
| disabled={!isUserConnected || isUserMissingPrimeToken} | ||
| hideErrorDescription |
There was a problem hiding this comment.
I'd recommend taking a different approach.
This form is behaving differently in the sense that we use a custom UI to show errors. The designs were made quite a while ago and so I think we'd be better off staying consistent with the newest form.
So the approach I propose is to update the useForm hook of this component so that the error that's set on the field isn't an error code but rather the full error message. This means the RhfTokenTextField component won't need to be updated and will natively display the human-friendly error message.
There was a problem hiding this comment.
Makes sense, fully agree — going with the consistent form pattern is cleaner. I've updated the useForm hooks for both Repay and Borrow to set the translated message directly on the field, and removed the custom NoticeError UI in the parent components. RhfTokenTextField is back to untouched and now natively shows the human-friendly message.
One small note — I kept ErrorCode.REQUIRES_RISK_ACKNOWLEDGEMENT as-is on the acknowledgeRisk field since it's only used as an internal state marker (never displayed to the user, and there's no matching i18n key for it). Let me know if you'd prefer to clean that up too. 😄
|
@greptile review again |

Jira ticket(s)
VPD-1256
Changes
before:

after: