3x-ui/frontend/src
Mr. Nickson ecadfd0e60
fix(clients): stop recomputing the summary badges from the client_stats snapshot (#6169)
* fix(clients): stop recomputing the summary badges from the client_stats snapshot

pickClientsSummary's coverage guard (serverSummary.total >
allClientStats.length) only catches a net shortfall: an orphaned
client_traffics row and a client still missing one can cancel out, or an
orphan surplus alone can pass uncaught, and either way the guard fails to
fall back (#6116).

client_paging.go's q.summary() already derives the same bucket counts with
clients as the driving table (LEFT JOIN client_traffics), so it cannot
miscount either shape regardless of how the row got there, and listQuery
already polls it every 5s — the same cadence client_stats ticks on. The
client-side recompute bought no fresher a number than the server already
provides on its own poll, only a window to get one wrong, so this drops it:
the summary badges now always read serverSummary directly. allClientStats,
computeClientsSummary, pickClientsSummary and sameSummaryInputs are removed
as dead code along with it; the per-row live traffic patch in
applyClientStatsEvent is untouched, since it reads the same snapshot by
email match rather than by count and was never exposed to this class of bug.

* fix(clients): force a refetch on window focus and drop a stale comment

Review feedback on PR #6169:

listQuery combines staleTime: Infinity with refetchInterval: 5000, which
pauses while the tab is hidden. The WS-driven per-row traffic patch in
applyClientStatsEvent has no such visibility gating, so on a background tab
a row's live numbers keep moving while the summary badges above them freeze
at whatever they were before the tab was hidden, and staleTime: Infinity
blocks refetchOnWindowFocus from closing that gap on return. Before this
PR the client-side recompute this branch removed happened to paper over the
same underlying gap; now that it's gone, the gap is directly visible.
refetchOnWindowFocus: 'always' forces exactly one refetch on refocus,
ignoring staleTime, without touching the interval/staleTime pairing that
governs the rest of this query's behavior.

Separately, useInbounds.ts still referenced computeClientsSummary by name
in a comment explaining bucket priority; that function no longer exists
after this PR. Dropped the comment rather than repoint it, per the repo's
no-//-comment convention.
2026-08-14 16:45:31 +02:00
..
api fix(frontend): clean test validation output 2026-08-12 15:35:20 +02:00
components refactor(frontend): remove unreachable barrel modules (#6205) 2026-08-13 12:45:26 +02:00
entries refactor(frontend): replace axios with the native Fetch API 2026-07-08 01:09:18 +02:00
generated inbounds: allow custom monthly traffic reset days (#6071) 2026-07-28 23:27:09 +02:00
hooks fix(clients): stop recomputing the summary badges from the client_stats snapshot (#6169) 2026-08-14 16:45:31 +02:00
i18n refactor: focused service files, leaf subpackages, and an internal/ layout (#5167) 2026-06-10 15:19:22 +02:00
layouts fix(ui): reserve space for pinned sidebar 2026-07-30 14:52:38 +08:00
lib fix(outbound): import Hysteria2 salamander properly from standard obfs params (#6166) 2026-08-14 16:43:29 +02:00
models feat(ui): redesign the overview page as a trend-first command deck 2026-07-29 20:17:37 +02:00
pages fix(clients): stop recomputing the summary badges from the client_stats snapshot (#6169) 2026-08-14 16:45:31 +02:00
schemas refactor(frontend): remove unused response envelope schema (#6204) 2026-08-13 12:46:00 +02:00
styles feat(hosts): managed Hosts for per-host subscription link overrides (#5409) 2026-06-17 12:06:55 +02:00
test fix(clients): stop recomputing the summary badges from the client_stats snapshot (#6169) 2026-08-14 16:45:31 +02:00
utils refactor(frontend): remove unused legacy utilities (#6206) 2026-08-13 12:27:40 +02:00
env.d.ts refactor(frontend): replace axios with the native Fetch API 2026-07-08 01:09:18 +02:00
main.tsx chore(deps): migrate to react-router 8 and refresh frontend dependencies 2026-07-25 02:07:15 +02:00
queryClient.ts feat(frontend): TanStack Query + React Router migration & in-panel API docs (#4541) 2026-05-24 21:34:52 +02:00
routes.tsx chore(deps): migrate to react-router 8 and refresh frontend dependencies 2026-07-25 02:07:15 +02:00