[PR #5225] [MERGED] fix(inbound): preserve custom share strategy on edit #5823

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5225
Author: @yuanzhidao
Created: 6/12/2026
Status: ✅ Merged
Merged: 6/12/2026
Merged by: @MHSanaei

Base: main ← Head: fix/inbound-share-strategy-form-state


📝 Commits (1)

  • 4addc8f fix(inbound): preserve custom share strategy on edit

📊 Changes

2 files changed (+39 additions, -1 deletions)

View changed files

📝 frontend/src/pages/inbounds/form/InboundFormModal.tsx (+2 -1)
📝 frontend/src/test/inbound-form-modal.test.tsx (+37 -0)

📄 Description

Summary

Preserve an inbound's saved custom share address strategy when reopening the edit form for a local inbound where the node share option is unavailable.

Why

Fixes #5224.

The edit modal initialized the saved inbound values, but a later effect used a stale watched shareAddrStrategy value from the previous render. For local inbounds without an available node share option, that stale default could overwrite a saved custom strategy with listen, so saving the form would lose the custom share address selection.

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 regression test for editing a local inbound with shareAddrStrategy: "custom" and shareAddr: "edge.example.test"; before the form-state fix, the custom share address field was not rendered because the strategy was overwritten to listen.

Validated locally with:

  • cd frontend && npm run test -- src/test/inbound-form-modal.test.tsx src/test/inbound-link.test.ts src/test/inbound-form-adapter.test.ts
  • cd frontend && npm run test
  • cd frontend && npm run typecheck
  • cd frontend && npm run lint
  • cd frontend && npm run build
  • go build ./...
  • go test ./...
  • git diff --check origin/main...HEAD

A real multi-node panel deployment was not run; this change is covered by a focused form-state regression test plus the existing link/form adapter suites.

Screenshots / recordings

N/A. This fixes form state preservation without changing the visual 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/5225 **Author:** [@yuanzhidao](https://github.com/yuanzhidao) **Created:** 6/12/2026 **Status:** ✅ Merged **Merged:** 6/12/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/inbound-share-strategy-form-state` --- ### 📝 Commits (1) - [`4addc8f`](https://github.com/MHSanaei/3x-ui/commit/4addc8ffa411aeed4389c9dffc8a576e114f3e56) fix(inbound): preserve custom share strategy on edit ### 📊 Changes **2 files changed** (+39 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/pages/inbounds/form/InboundFormModal.tsx` (+2 -1) 📝 `frontend/src/test/inbound-form-modal.test.tsx` (+37 -0) </details> ### 📄 Description ## Summary Preserve an inbound's saved custom share address strategy when reopening the edit form for a local inbound where the node share option is unavailable. ## Why Fixes #5224. The edit modal initialized the saved inbound values, but a later effect used a stale watched `shareAddrStrategy` value from the previous render. For local inbounds without an available node share option, that stale default could overwrite a saved `custom` strategy with `listen`, so saving the form would lose the custom share address selection. ## 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 - [x] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? Added a regression test for editing a local inbound with `shareAddrStrategy: "custom"` and `shareAddr: "edge.example.test"`; before the form-state fix, the custom share address field was not rendered because the strategy was overwritten to `listen`. Validated locally with: - `cd frontend && npm run test -- src/test/inbound-form-modal.test.tsx src/test/inbound-link.test.ts src/test/inbound-form-adapter.test.ts` - `cd frontend && npm run test` - `cd frontend && npm run typecheck` - `cd frontend && npm run lint` - `cd frontend && npm run build` - `go build ./...` - `go test ./...` - `git diff --check origin/main...HEAD` A real multi-node panel deployment was not run; this change is covered by a focused form-state regression test plus the existing link/form adapter suites. ## Screenshots / recordings N/A. This fixes form state preservation without changing the visual 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. - [ ] 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:04:20 +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#5823
No description provided.