- refactored state for sessionlist, and session active and pause states

This commit is contained in:
2025-10-27 11:04:53 +00:00
parent 251a2f5e7b
commit 2d5b264041
7 changed files with 44 additions and 41 deletions

View File

@@ -70,9 +70,11 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
mostRecent,
isLoading,
} = useSightingFeedContext();
console.log(sightings);
const { dispatch } = useAlertHitContext();
const { sessionStarted, setSessionList, sessionList, sessionPaused } = useIntegrationsContext();
const { state: integrationState, dispatch: integrationDispatch } = useIntegrationsContext();
const sessionStarted = integrationState.sessionStarted;
const sessionPaused = integrationState.sessionPaused;
const processedRefs = useRef<Set<number | string>>(new Set());
@@ -99,10 +101,10 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
if (!mostRecent) return;
if (sessionPaused) return;
const reducedMostRecent = reduceObject(mostRecent);
setSessionList([...sessionList, reducedMostRecent]);
integrationDispatch({ type: "ADD", payload: reducedMostRecent });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [mostRecent, sessionStarted, setSessionList]);
}, [mostRecent, sessionStarted]);
const onRowClick = useCallback(
(sighting: SightingType) => {