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.
This commit is contained in:
rcourtman
2026-06-27 00:04:51 +01:00
parent 3fa0a316e2
commit bd0220ca58
@@ -10,6 +10,7 @@ import {
type DisplayMetricType,
resolveMetricDisplayThresholds,
} from '@/utils/metricThresholds';
import { eventBus } from './events';
// Create signals for activation state
const [config, setConfig] = createSignal<AlertConfig | null>(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