fix(ui): блокировать изменение проб во время Speed-test

This commit is contained in:
Denozordec committed 2026-09-21 21:14:13 +07:00
1 parent ce14f5de3e
commit cc40a5e33d
4 files changed
+46 -2

No files matched your search

+8
View File
@@ -1723,6 +1723,10 @@ function UptimePageContent({ selectedProbeId, allProbesHref }: { selectedProbeId
const runSpeedTest = async (probe: SpeedProbeRow) => {
if (!requireWrite()) return
if (!probe.srcServerId || !probe.dstServerId || probe.srcServerId === probe.dstServerId) return
savingRef.current = true
setProbeSaving(true)
overviewReqRef.current++
const context = ++saveContext.current
setSpeedError(null)
setSpeedBusy(true)
const durationSec = Math.max(3, Number.parseInt(probe.durationSec, 10) || 10)
@@ -1771,6 +1775,7 @@ function UptimePageContent({ selectedProbeId, allProbesHref }: { selectedProbeId
method: "POST",
body: JSON.stringify(payload),
})
if (context !== saveContext.current) return
const ap = res.result.afterBtPing
const lines = (res.result.raw ?? []).flatMap((row) =>
Object.entries(row).map(([k, v]) => `${k}: ${String(v)}`),
@@ -1844,6 +1849,7 @@ function UptimePageContent({ selectedProbeId, allProbesHref }: { selectedProbeId
}) : p))
}
} catch (e) {
if (context !== saveContext.current) return
const message = e instanceof Error ? e.message : "Не удалось выполнить speed test"
setSpeedRuns((prev) => prev.map((r) => r.id === runId ? ({
...r,
@@ -1858,6 +1864,8 @@ function UptimePageContent({ selectedProbeId, allProbesHref }: { selectedProbeId
lastError: message,
}) : p))
} finally {
savingRef.current = false
setProbeSaving(false)
setSpeedBusy(false)
}
}