- refactored state for sessionlist, and session active and pause states
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user