From 399dc97808ffbebc2c11c9cf9f6f9fa11416f362 Mon Sep 17 00:00:00 2001 From: Saman Pandey Date: Sun, 3 May 2026 20:00:17 +0530 Subject: [PATCH] fix: the decision modal is now working fine --- .../app/components/alerts/AlertToast.jsx | 15 ++- .../app/components/decision/DecisionModal.jsx | 9 +- dashboard/app/demo/page.js | 101 ++++++++---------- dashboard/app/hooks/useDemoInject.js | 95 ++++++++++++++++ 4 files changed, 162 insertions(+), 58 deletions(-) create mode 100644 dashboard/app/hooks/useDemoInject.js diff --git a/dashboard/app/components/alerts/AlertToast.jsx b/dashboard/app/components/alerts/AlertToast.jsx index 207c6ef..b2c7555 100644 --- a/dashboard/app/components/alerts/AlertToast.jsx +++ b/dashboard/app/components/alerts/AlertToast.jsx @@ -3,6 +3,7 @@ import { useEffect, useRef } from 'react'; import { toast } from 'sonner'; import { useAlertStore } from '../../store/alertStore.js'; +import { useDemoInject } from '../../hooks/useDemoInject.js'; const TYPE_ICONS = { WEATHER: '🌊', @@ -20,6 +21,8 @@ export default function AlertToastController() { const disruptions = useAlertStore((s) => s.disruptions); const prevLengthRef = useRef(null); const seenIdsRef = useRef(new Set()); + const activeInjectionsRef = useRef(new Set()); + const { injectDisruption } = useDemoInject(null); useEffect(() => { // Record initial snapshot as baseline so existing disruptions do not trigger toasts. @@ -68,7 +71,15 @@ export default function AlertToastController() {