mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5626] [MERGED] fix(balancers): defer validation errors until touched or save #5936
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5936
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5626
Author: @nima1024m
Created: 6/28/2026
Status: ✅ Merged
Merged: 6/28/2026
Merged by: @MHSanaei
Base:
main← Head:fix/balancer-modal-premature-validation📝 Commits (1)
9366fdefix(balancers): defer validation errors until touched or save📊 Changes
2 files changed (+77 additions, -7 deletions)
View changed files
📝
frontend/src/pages/xray/balancers/BalancerFormModal.tsx(+19 -7)➕
frontend/src/test/balancer-form-modal.test.tsx(+58 -0)📄 Description
Problem
Opening Xray → Balancers → "+ Balancers" showed validation errors ("Tag is required", "Pick at least one outbound") the instant the modal opened, before any user interaction.
Cause
BalancerFormModalranBalancerFormSchema.safeParseon its empty initial state at mount and bound theForm.ItemvalidateStatus/helpdirectly to the result, so the errors rendered immediately.Fix
touchedtracking plus asubmitAttemptedflag — errors now appear only after a field is touched or the user clicks Create.RuleFormModal) so a save attempt surfaces the errors.key-based remount inBalancersTabresets the flags on every open, so nouseEffectreset is needed.Testing
frontend/src/test/balancer-form-modal.test.tsx: asserts no errors on fresh open, and that both errors appear only after a save attempt (without callingonConfirm).npm run typecheck,npm run lint, and the fullvitestsuite (601 tests / 42 files) pass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.