From bd0220ca58980326c8ad02050665df4af3ac332a Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sat, 27 Jun 2026 00:04:51 +0100 Subject: [PATCH] Clear alerts activation config on org switch The alertsActivation store (config, activation state, active alerts, error) was not reset on org switch. Stale config from the previous org (thresholds, activation state) persisted until the next page navigation triggered refreshConfig. --- frontend-modern/src/stores/alertsActivation.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend-modern/src/stores/alertsActivation.ts b/frontend-modern/src/stores/alertsActivation.ts index 0f8b3fcd6..74888fcbf 100644 --- a/frontend-modern/src/stores/alertsActivation.ts +++ b/frontend-modern/src/stores/alertsActivation.ts @@ -10,6 +10,7 @@ import { type DisplayMetricType, resolveMetricDisplayThresholds, } from '@/utils/metricThresholds'; +import { eventBus } from './events'; // Create signals for activation state const [config, setConfig] = createSignal(null); @@ -146,6 +147,14 @@ const getMetricThresholds = ( return resolveMetricDisplayThresholds(config(), scope, metric, resourceIds); }; +eventBus.on('org_switched', () => { + setConfig(null); + applyActivationState(null); + setActiveAlerts([]); + setLastError(null); + setIsLoading(false); +}); + // Export the store export const useAlertsActivation = () => ({ // Signals