mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5298] [Bug]: Subscription sort order not working #3711
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#3711
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?
Originally created by @AmirSalar-Yn on GitHub (Jun 13, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5298
Describe the bug
subscription sort order is not working properly and every time you close the modify inbound windows it resets to 1 which is the default value, surprisingly some inbounds keep the value somehow but others don't
How to reproduce the problem
open edit an inbound
change the sort value to sth else rather than 1
save and close
reopen the edit window
value is set back to 1
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
v3.3.1
Xray-core version
v26.6.1
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24
Which parts of the panel are affected?
Frontend (UI / panel pages), Backend (API endpoints, login, settings)
Browser (only if it is a UI bug)
Chrome latest version
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Jun 13, 2026):
The
subSortIndexfield was introduced in v3.3.1 (released 2026-06-12, the same day as this report), so the behavior you are hitting is consistent with an early-adopter bug in a brand-new field.What the code does (confirmed in source)
internal/database/model/model.go—Inbound.SubSortIndexcarriesgorm:"default:1", which means GORM'sAutoMigrateadds the column withDEFAULT 1when upgrading from an older install.internal/database/db.go— on every startup,normalizeInboundSubSortIndex()runsUPDATE inbounds SET sub_sort_index = 1 WHERE sub_sort_index < 1to clamp any zero values.internal/web/service/inbound.go—UpdateInboundexplicitly copiesSubSortIndexfrom the incoming payload before callingtx.Save.frontend/src/lib/xray/inbound-form-adapter.ts—rawInboundToFormValuesreadsrow.subSortIndexandformValuesToWirePayloadincludes it in the POST body.Everything in the read/write path looks structurally correct, so I cannot reproduce the reset from code inspection alone. A few targeted diagnostics would narrow it down quickly.
To help pinpoint the cause, please provide:
Network tab confirmation — Open Chrome DevTools → Network tab. Reproduce the issue: open an affected inbound, change
subSortIndexto something other than 1, and click Save. Find thePOST /panel/api/inbounds/update/<id>request. In its Request Payload (or body), paste the value of thesubSortIndexkey. This confirms whether the browser is actually sending the new value.Response payload — On the same request, check the Response tab. Paste the
subSortIndexfield from the JSON response.Affected vs unaffected inbounds — Were the inbounds that do not retain the value created before upgrading to v3.3.1, or after? Were those that do retain it created fresh in v3.3.1?
Console errors — Any JavaScript errors in the browser console around the time of saving?
One known edge case to be aware of
The startup normalization query —
WHERE sub_sort_index < 1— does not matchNULLin SQL (becauseNULL < 1evaluates toUNKNOWN, notTRUE). If any rows have a literalNULLvalue for the column (possible if the migration ran in an unusual environment), those rows would appear assubSortIndex: 0in the API, and the form would display1via theMath.max(1, 0)clamp. This would not cause a persistent reset on its own, but it is worth ruling out. If you have SQLite access, runningSELECT id, sub_sort_index FROM inbounds WHERE sub_sort_index IS NULL;on/etc/x-ui/x-ui.dbwould confirm or exclude this.This reply was generated automatically; a maintainer may follow up.