[PR #6084] [MERGED] fix(inbounds): surface form validation errors #6077

Closed
opened 2026-11-02 04:06:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6084
Author: @narcotics0507
Created: 7/23/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @MHSanaei

Base: main ← Head: agent/inbound-form-validation-feedback


📝 Commits (3)

  • f28e7d0 inbounds: surface form validation errors
  • d8a7710 Merge branch 'main' into agent/inbound-form-validation-feedback
  • b634fcd Fix inbound form tab error navigation

📊 Changes

2 files changed (+157 additions, -5 deletions)

View changed files

📝 frontend/src/pages/inbounds/form/InboundFormModal.tsx (+51 -3)
📝 frontend/src/test/inbound-form-modal.test.tsx (+106 -2)

📄 Description

Summary

  • Show the first React Hook Form field error when an inbound save is blocked.
  • Switch the modal to the tab that contains the invalid field.
  • Add regression coverage for invalid and valid clone-like Reality inbounds.

Why

After the React Hook Form migration in #5859, the inbound modal calls
methods.trigger() and returns immediately when field validation fails. If the
invalid field is on another tab, Save appears to do nothing: there is no toast
and the field error is not visible.

This change keeps the existing validation rules and payload path intact. It
uses the invalid callback from handleSubmit to report the first field error
and reveal the relevant tab.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

  • Added a component regression test that opens a clone-like VLESS Reality
    inbound with an invalid target, clicks Save, verifies that no update is sent,
    checks the error toast, and confirms that the Security tab is selected.
  • Added a positive test that confirms a valid clone-like Reality inbound still
    reaches the existing update endpoint.
  • npm run lint
  • npm run typecheck
  • npm test — 96 files and 889 tests passed
  • npm run build
  • npm run build-storybook
  • go build ./... in the official Go 1.26 Docker image

Screenshots / recordings

N/A — this is behavioral feedback in the existing modal, covered by the
component regression test; it does not change the static layout.

Breaking changes

None.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6084 **Author:** [@narcotics0507](https://github.com/narcotics0507) **Created:** 7/23/2026 **Status:** ✅ Merged **Merged:** 8/15/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `agent/inbound-form-validation-feedback` --- ### 📝 Commits (3) - [`f28e7d0`](https://github.com/MHSanaei/3x-ui/commit/f28e7d05cd181538c0a469f767d9d97577b2bbd1) inbounds: surface form validation errors - [`d8a7710`](https://github.com/MHSanaei/3x-ui/commit/d8a77104d64692fac5109c84eb7dd6ff6189a576) Merge branch 'main' into agent/inbound-form-validation-feedback - [`b634fcd`](https://github.com/MHSanaei/3x-ui/commit/b634fcdc31cbb248dc9217a782919c2b9dae8a4e) Fix inbound form tab error navigation ### 📊 Changes **2 files changed** (+157 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/pages/inbounds/form/InboundFormModal.tsx` (+51 -3) 📝 `frontend/src/test/inbound-form-modal.test.tsx` (+106 -2) </details> ### 📄 Description ## Summary - Show the first React Hook Form field error when an inbound save is blocked. - Switch the modal to the tab that contains the invalid field. - Add regression coverage for invalid and valid clone-like Reality inbounds. ## Why After the React Hook Form migration in #5859, the inbound modal calls `methods.trigger()` and returns immediately when field validation fails. If the invalid field is on another tab, Save appears to do nothing: there is no toast and the field error is not visible. This change keeps the existing validation rules and payload path intact. It uses the invalid callback from `handleSubmit` to report the first field error and reveal the relevant tab. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [ ] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? - Added a component regression test that opens a clone-like VLESS Reality inbound with an invalid target, clicks Save, verifies that no update is sent, checks the error toast, and confirms that the Security tab is selected. - Added a positive test that confirms a valid clone-like Reality inbound still reaches the existing update endpoint. - `npm run lint` - `npm run typecheck` - `npm test` — 96 files and 889 tests passed - `npm run build` - `npm run build-storybook` - `go build ./...` in the official Go 1.26 Docker image ## Screenshots / recordings N/A — this is behavioral feedback in the existing modal, covered by the component regression test; it does not change the static layout. ## Breaking changes None. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] `go build ./...` and the test suite pass locally. - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. - [x] I updated the Wiki / README / API docs if user-facing behavior changed. - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:06:12 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6077
No description provided.