mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-14 19:55:51 +00:00
Merge pull request #513 from guarzo/guarzo/killfilter
fix: removed wormhole only logic error
This commit is contained in:
@@ -16,8 +16,21 @@ const SystemKillsContent = () => {
|
|||||||
} = useMapRootState();
|
} = useMapRootState();
|
||||||
|
|
||||||
const [systemId] = selectedSystems || [];
|
const [systemId] = selectedSystems || [];
|
||||||
|
const whCacheRef = useMemo(() => new Map<number, boolean>(), []);
|
||||||
|
|
||||||
const systemStaticInfo = getSystemStaticInfo(systemId)!;
|
const isWormholeSystem = useCallback(
|
||||||
|
(systemId: number): boolean => {
|
||||||
|
const cached = whCacheRef.get(systemId);
|
||||||
|
if (cached !== undefined) return cached;
|
||||||
|
|
||||||
|
const info = getSystemStaticInfo(systemId);
|
||||||
|
const isWH = info?.system_class != null ? isWormholeSpace(Number(info.system_class)) : false;
|
||||||
|
|
||||||
|
whCacheRef.set(systemId, isWH);
|
||||||
|
return isWH;
|
||||||
|
},
|
||||||
|
[whCacheRef],
|
||||||
|
);
|
||||||
|
|
||||||
const { kills, isLoading, error } = useSystemKills({
|
const { kills, isLoading, error } = useSystemKills({
|
||||||
systemId,
|
systemId,
|
||||||
@@ -30,15 +43,9 @@ 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 => {
|
return kills.filter(kill => isWormholeSystem(Number(kill.solar_system_id)));
|
||||||
if (!systemStaticInfo) {
|
}, [kills, settingsKills.whOnly, isWormholeSystem]);
|
||||||
console.warn(`System with id ${kill.solar_system_id} not found.`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return isWormholeSpace(systemStaticInfo.system_class);
|
|
||||||
});
|
|
||||||
}, [kills, settingsKills.whOnly, systemStaticInfo, settingsKills.showAll]);
|
|
||||||
|
|
||||||
if (!isSubscriptionActive) {
|
if (!isSubscriptionActive) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user