mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-07-10 00:14:38 +00:00
Clear AI intelligence state on org switch to prevent data bleed
The aiIntelligence store (findings, patrol findings, remediation plans, pending approvals, circuit breaker, correlations) was not reset when switching organizations. Findings from the previous org would remain visible until the next polling cycle refreshed them. Added org_switched event listener that resets all signals and clears the pending approval expiry timer.
This commit is contained in:
parent
fa3f57e6ba
commit
eebe0b5f74
1 changed files with 23 additions and 0 deletions
|
|
@ -40,6 +40,7 @@ import { logger } from '@/utils/logger';
|
|||
import type { CorrelationsResponse, IntelligenceSummary } from '@/types/aiIntelligence';
|
||||
import { normalizeIntelligenceSummary } from './aiIntelligenceSummaryModel';
|
||||
import { presentationPolicyIsDemoMode } from './sessionPresentationPolicy';
|
||||
import { eventBus } from './events';
|
||||
|
||||
// ============================================
|
||||
// Enum validation helpers
|
||||
|
|
@ -425,6 +426,28 @@ const [intelligenceSummary, setIntelligenceSummary] = createSignal<IntelligenceS
|
|||
|
||||
const [correlations, setCorrelations] = createSignal<CorrelationsResponse | null>(null);
|
||||
|
||||
// ============================================
|
||||
// Org Switch Reset
|
||||
// ============================================
|
||||
|
||||
eventBus.on('org_switched', () => {
|
||||
setUnifiedFindings([]);
|
||||
setFindingsLoading(false);
|
||||
setFindingsError(null);
|
||||
setPatrolFindings([]);
|
||||
setPatrolFindingsLoading(false);
|
||||
setPatrolFindingsError(null);
|
||||
patrolFindingsIncludeResolvedPreference = false;
|
||||
setRemediationPlans([]);
|
||||
setPlansLoading(false);
|
||||
setPlansError(null);
|
||||
setPendingApprovalsWithExpiryTracking([]);
|
||||
setApprovalsError(null);
|
||||
setCircuitBreakerStatus(null);
|
||||
setIntelligenceSummary(null);
|
||||
setCorrelations(null);
|
||||
});
|
||||
|
||||
// ============================================
|
||||
// Store API
|
||||
// ============================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue