mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-11 14:00:29 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user