mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-29 22:47:14 +00:00
fix(clients): invalidate Xray config cache after client mutations
Client add/update/remove also rewrite settings.clients on each attached inbound, so the Xray config query could go stale. Invalidate it alongside the clients and inbounds buckets.
This commit is contained in:
@@ -255,12 +255,6 @@ export function useClients() {
|
|||||||
return { ...live, total: serverSummary.total || live.total };
|
return { ...live, total: serverSummary.total || live.total };
|
||||||
}, [allClientStats, onlines, expireDiff, trafficDiff, listQuery.data?.summary]);
|
}, [allClientStats, onlines, expireDiff, trafficDiff, listQuery.data?.summary]);
|
||||||
|
|
||||||
// Client mutations (add/update/remove/attach/detach/resetTraffic/…) all
|
|
||||||
// mutate inbound rows server-side too — adding a client appends to
|
|
||||||
// settings.clients on each attached inbound, the slim list's per-inbound
|
|
||||||
// client count is derived from that. Invalidate both buckets so the
|
|
||||||
// Inbounds page and any open edit modal pick up the new shape without
|
|
||||||
// a manual reload.
|
|
||||||
const invalidateAll = useCallback(
|
const invalidateAll = useCallback(
|
||||||
() => {
|
() => {
|
||||||
markLocalInvalidate();
|
markLocalInvalidate();
|
||||||
@@ -268,6 +262,7 @@ export function useClients() {
|
|||||||
return Promise.all([
|
return Promise.all([
|
||||||
queryClient.invalidateQueries({ queryKey: keys.clients.root() }),
|
queryClient.invalidateQueries({ queryKey: keys.clients.root() }),
|
||||||
queryClient.invalidateQueries({ queryKey: keys.inbounds.root() }),
|
queryClient.invalidateQueries({ queryKey: keys.inbounds.root() }),
|
||||||
|
queryClient.invalidateQueries({ queryKey: keys.xray.config() }),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
[queryClient],
|
[queryClient],
|
||||||
|
|||||||
Reference in New Issue
Block a user