-address fixes and changes per feedback from Matt and Brad
This commit is contained in:
@@ -59,11 +59,10 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
|
||||
isLoading,
|
||||
} = useSightingFeedContext();
|
||||
|
||||
const { dispatch } = useAlertHitContext();
|
||||
const { dispatch, state: alertState } = useAlertHitContext();
|
||||
const { state: integrationState, dispatch: integrationDispatch } = useIntegrationsContext();
|
||||
const sessionStarted = integrationState.sessionStarted;
|
||||
const sessionPaused = integrationState.sessionPaused;
|
||||
|
||||
const processedRefs = useRef<Set<number | string>>(new Set());
|
||||
|
||||
const hasAutoOpenedRef = useRef(false);
|
||||
@@ -72,6 +71,11 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
|
||||
const enqueue = useCallback((sighting: SightingType, kind: HitKind) => {
|
||||
const id = sighting.vrm ?? sighting.ref;
|
||||
if (processedRefs.current.has(id)) return;
|
||||
|
||||
const inList = alertState?.alertList?.find((sighting) => sighting.vrm === id);
|
||||
if (inList) {
|
||||
return;
|
||||
}
|
||||
processedRefs.current.add(id);
|
||||
|
||||
setModalQueue((q) => [...q, { id, sighting, kind }]);
|
||||
@@ -154,7 +158,6 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
|
||||
|
||||
if (firstNPED) {
|
||||
enqueue(firstNPED, "NPED");
|
||||
|
||||
npedRef.current = true;
|
||||
}
|
||||
|
||||
@@ -173,6 +176,7 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
|
||||
else hotlistsound();
|
||||
|
||||
setSelectedSighting(next.sighting);
|
||||
|
||||
setSightingModalOpen(true);
|
||||
}
|
||||
}, [isSightingModalOpen, npedSound, hotlistsound, setSelectedSighting, setSightingModalOpen, modalQueue]);
|
||||
|
||||
Reference in New Issue
Block a user