From 620923c27e7b6a6c07a39e904c42112686a124f7 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 18 May 2026 08:49:25 -0500 Subject: [PATCH] clear both detector and model together (#23232) --- .../DetectorsAndModelSettingsView.tsx | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/web/src/views/settings/DetectorsAndModelSettingsView.tsx b/web/src/views/settings/DetectorsAndModelSettingsView.tsx index 6780428da4..bb18ed2777 100644 --- a/web/src/views/settings/DetectorsAndModelSettingsView.tsx +++ b/web/src/views/settings/DetectorsAndModelSettingsView.tsx @@ -373,27 +373,15 @@ export default function DetectorsAndModelSettingsView({ setIsSaving(true); try { - if (tabChanged) { - // Best-effort cleanup of the prior model's fields + // Pre-clear both `detectors` and `model` together when a renaming + if (tabChanged || detectorKeysChanged) { try { await axios.put("config/set", { requires_restart: 0, - config_data: { model: null }, + config_data: { detectors: null, model: null }, }); } catch { - // intentional no-op — see comment above - } - } - - if (detectorKeysChanged) { - // Best-effort cleanup - try { - await axios.put("config/set", { - requires_restart: 0, - config_data: { detectors: null }, - }); - } catch { - // intentional no-op — see comment above + // best-effort cleanup } }