From 9cbba130ab9cf405397bf26df125fc69f7d2dd7b Mon Sep 17 00:00:00 2001 From: Ali Fotouhi <49165697+iAliF@users.noreply.github.com> Date: Sun, 10 May 2026 13:33:00 +0330 Subject: [PATCH] fix(xray): clear outbound test state on delete to prevent result bleed (#4205) --- frontend/src/pages/xray/OutboundsTab.vue | 4 ++-- frontend/src/pages/xray/XrayPage.vue | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/xray/OutboundsTab.vue b/frontend/src/pages/xray/OutboundsTab.vue index a0d489dd..ee7bdf4f 100644 --- a/frontend/src/pages/xray/OutboundsTab.vue +++ b/frontend/src/pages/xray/OutboundsTab.vue @@ -48,7 +48,7 @@ const inboundTagOptions = computed(() => { return [...out]; }); -const emit = defineEmits(['reset-traffic', 'test', 'show-warp', 'show-nord']); +const emit = defineEmits(['reset-traffic', 'test', 'show-warp', 'show-nord', 'delete']); // === Modal state ==================================================== const modalOpen = ref(false); @@ -86,7 +86,7 @@ function confirmDelete(idx) { okText: t('delete'), okType: 'danger', cancelText: t('cancel'), - onOk: () => { props.templateSettings.outbounds.splice(idx, 1); }, + onOk: () => { emit('delete', idx); }, }); } function setFirst(idx) { diff --git a/frontend/src/pages/xray/XrayPage.vue b/frontend/src/pages/xray/XrayPage.vue index 88085563..c4d94c76 100644 --- a/frontend/src/pages/xray/XrayPage.vue +++ b/frontend/src/pages/xray/XrayPage.vue @@ -57,6 +57,15 @@ async function onTestOutbound(idx) { if (outbound) await testOutbound(idx, outbound); } +function onDeleteOutbound(idx) { + templateSettings.value.outbounds.splice(idx, 1); + outboundTestStates.value = Object.fromEntries( + Object.entries(outboundTestStates.value) + .filter(([k]) => Number(k) !== idx) + .map(([k, v]) => [Number(k) > idx ? Number(k) - 1 : Number(k), v]), + ); +} + // === Advanced tab — radio-driven view ============================== // Mirrors the legacy advanced page: a 4-way radio toggles which slice // of the xray config the textarea edits — the full config, just the @@ -298,6 +307,7 @@ function confirmRestart() { :is-mobile="isMobile" @reset-traffic="resetOutboundsTraffic" @test="onTestOutbound" + @delete="onDeleteOutbound" @show-warp="showWarp" @show-nord="showNord" />