From 989333b0b103e4a26f2c70e96008da305da68b84 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Tue, 26 May 2026 23:53:54 +0200 Subject: [PATCH] fix(frontend): serialize bulk client delete + drop deprecated Alert.message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit useClients.removeMany was firing all DELETEs in parallel via Promise.all. The 3x-ui backend mutates a single config JSON per request (read / modify / write), so 20 concurrent deletes raced on the same file: every request reported success, but only the last writer's copy stuck — about half the selected clients reappeared after the toast. Replace the parallel fan-out with a sequential for-of loop so each delete sees the committed state of the previous one. The trade-off is total latency (20 * ~250ms = ~5s) which is the correct behavior until the backend grows a proper /bulkDel endpoint. Also rename the Alert `message` prop to `title` in ClientBulkAdjustModal to clear the AntD v6 deprecation warning. --- frontend/src/hooks/useClients.ts | 8 +++++--- frontend/src/pages/clients/ClientBulkAdjustModal.tsx | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/hooks/useClients.ts b/frontend/src/hooks/useClients.ts index 51901c77..6131bdaa 100644 --- a/frontend/src/hooks/useClients.ts +++ b/frontend/src/hooks/useClients.ts @@ -212,10 +212,12 @@ export function useClients() { const removeManyMut = useMutation({ mutationFn: async ({ emails, keepTraffic }: { emails: string[]; keepTraffic?: boolean }) => { const suffix = keepTraffic ? '?keepTraffic=1' : ''; - const results = await Promise.all(emails.map((email) => { + const results: Msg[] = []; + for (const email of emails) { const url = `/panel/api/clients/del/${encodeURIComponent(email)}${suffix}`; - return HttpUtil.post(url, undefined, { silent: true }); - })); + const res = await HttpUtil.post(url, undefined, { silent: true }); + results.push(res); + } return results; }, onSuccess: () => invalidateAll(), diff --git a/frontend/src/pages/clients/ClientBulkAdjustModal.tsx b/frontend/src/pages/clients/ClientBulkAdjustModal.tsx index e9f770c5..5fbab5a3 100644 --- a/frontend/src/pages/clients/ClientBulkAdjustModal.tsx +++ b/frontend/src/pages/clients/ClientBulkAdjustModal.tsx @@ -75,7 +75,7 @@ export default function ClientBulkAdjustModal({ open, count, onOpenChange, onSub type="info" showIcon style={{ marginBottom: 16 }} - message={t('pages.clients.bulkAdjustHint')} + title={t('pages.clients.bulkAdjustHint')} />