import { useEffect, useRef } from "react"; import { useEventContext } from "../state/events"; import { handleEventToast } from "./toast-rules"; export function EventToastBridge(): JSX.Element | null { const { events } = useEventContext(); const processedRef = useRef>(new Set()); useEffect(() => { for (const event of events) { const key = `${event.correlation_id}:${event.timestamp}`; if (processedRef.current.has(key)) continue; processedRef.current.add(key); handleEventToast(event); } }, [events]); return null; }