clear both detector and model together (#23232)

This commit is contained in:
Josh Hawkins authored and GitHub committed 2026-05-18 08:49:25 -05:00
1 parent 32daf6f494
commit 620923c27e
1 file changed
+4 -16
@@ -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
}
}