mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-12 18:56:01 +00:00
fix: pr feedback
This commit is contained in:
@@ -16,6 +16,21 @@ const SystemKillsContent = () => {
|
|||||||
} = useMapRootState();
|
} = useMapRootState();
|
||||||
|
|
||||||
const [systemId] = selectedSystems || [];
|
const [systemId] = selectedSystems || [];
|
||||||
|
const whCacheRef = useMemo(() => new Map<number, boolean>(), []);
|
||||||
|
|
||||||
|
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,24 +45,10 @@ const SystemKillsContent = () => {
|
|||||||
const filteredKills = useMemo(() => {
|
const filteredKills = useMemo(() => {
|
||||||
if (!settingsKills.whOnly) return kills;
|
if (!settingsKills.whOnly) return kills;
|
||||||
|
|
||||||
const whBySystem = new Map<number, boolean>();
|
const wormholeKills = kills.filter(kill => isWormholeSystem(Number(kill.solar_system_id)));
|
||||||
const wormholeKills = kills.filter(kill => {
|
|
||||||
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 isWH;
|
|
||||||
});
|
|
||||||
|
|
||||||
return wormholeKills;
|
return wormholeKills;
|
||||||
}, [kills, settingsKills.whOnly]);
|
}, [kills, settingsKills.whOnly, isWormholeSystem]);
|
||||||
|
|
||||||
if (!isSubscriptionActive) {
|
if (!isSubscriptionActive) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user