fix: removed wormhole only logic error

This commit is contained in:
guarzo
2025-09-05 01:15:18 +00:00
parent 968deeb254
commit 873946a1a6

View File

@@ -17,8 +17,6 @@ const SystemKillsContent = () => {
const [systemId] = selectedSystems || []; const [systemId] = selectedSystems || [];
const systemStaticInfo = getSystemStaticInfo(systemId)!;
const { kills, isLoading, error } = useSystemKills({ const { kills, isLoading, error } = useSystemKills({
systemId, systemId,
outCommand, outCommand,
@@ -30,15 +28,26 @@ const SystemKillsContent = () => {
const showLoading = isLoading && kills.length === 0; const showLoading = isLoading && kills.length === 0;
const filteredKills = useMemo(() => { const filteredKills = useMemo(() => {
if (!settingsKills.whOnly || !settingsKills.showAll) return kills; if (!settingsKills.whOnly) return kills;
return kills.filter(kill => {
if (!systemStaticInfo) { const whBySystem = new Map<number, boolean>();
console.warn(`System with id ${kill.solar_system_id} not found.`); const wormholeKills = kills.filter(kill => {
return false; const id = Number(kill.solar_system_id);
let isWH = whBySystem.get(id);
if (isWH === undefined) {
const info = getSystemStaticInfo(id);
if (!info || info.system_class == null) {
isWH = false;
} else {
isWH = isWormholeSpace(Number(info.system_class));
}
whBySystem.set(id, isWH);
} }
return isWormholeSpace(systemStaticInfo.system_class); return isWH;
}); });
}, [kills, settingsKills.whOnly, systemStaticInfo, settingsKills.showAll]);
return wormholeKills;
}, [kills, settingsKills.whOnly]);
if (!isSubscriptionActive) { if (!isSubscriptionActive) {
return ( return (