mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-19 13:42:09 +03:00
fix(agent-bridge-ui): remove double-write of risk-accepted localStorage (M5)
AgentCard.handleRiskAccept was calling markRiskAccepted() before opening the RiskNoticeModal, which itself writes the same key via dontShowAgainKey on accept. Remove the redundant markRiskAccepted call and delete the now-unused helper so RiskNoticeModal (D16) is the sole canonical persistence owner. Add a spy-based test asserting the key is written exactly once per accept.
This commit is contained in:
@@ -21,13 +21,6 @@ function hasAcceptedRisk(agentId: string): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
function markRiskAccepted(agentId: string): void {
|
||||
try {
|
||||
localStorage.setItem(RISK_STORAGE_KEY_PREFIX + agentId, "true");
|
||||
} catch {
|
||||
// ignore storage errors
|
||||
}
|
||||
}
|
||||
|
||||
interface AgentCardProps {
|
||||
target: MitmTarget;
|
||||
@@ -112,7 +105,6 @@ export function AgentCard({
|
||||
};
|
||||
|
||||
const handleRiskAccept = async () => {
|
||||
markRiskAccepted(target.id);
|
||||
setRiskModalOpen(false);
|
||||
await reallyToggleDns(true);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user