diff --git a/assets/js/hooks/Mapper/components/hooks/useSystemInfo.ts b/assets/js/hooks/Mapper/components/hooks/useSystemInfo.ts index c159b9c9..7d10fa6c 100644 --- a/assets/js/hooks/Mapper/components/hooks/useSystemInfo.ts +++ b/assets/js/hooks/Mapper/components/hooks/useSystemInfo.ts @@ -1,6 +1,6 @@ +import { getSystemById } from '@/hooks/Mapper/helpers'; import { useMapRootState } from '@/hooks/Mapper/mapRootProvider'; import { useMemo } from 'react'; -import { getSystemById } from '@/hooks/Mapper/helpers'; import { getSystemStaticInfo } from '../../mapRootProvider/hooks/useLoadSystemStatic'; interface UseSystemInfoProps { @@ -17,7 +17,7 @@ export const useSystemInfo = ({ systemId }: UseSystemInfoProps) => { const dynamicInfo = getSystemById(systems, systemId); if (!staticInfo || !dynamicInfo) { - throw new Error(`Error on getting system ${systemId}`); + return { dynamicInfo, staticInfo, leadsTo: [] }; } const leadsTo = connections diff --git a/assets/js/hooks/Mapper/components/mapInterface/components/SystemLinkSignatureDialog/SystemLinkSignatureDialog.tsx b/assets/js/hooks/Mapper/components/mapInterface/components/SystemLinkSignatureDialog/SystemLinkSignatureDialog.tsx index e29fe153..574e9561 100644 --- a/assets/js/hooks/Mapper/components/mapInterface/components/SystemLinkSignatureDialog/SystemLinkSignatureDialog.tsx +++ b/assets/js/hooks/Mapper/components/mapInterface/components/SystemLinkSignatureDialog/SystemLinkSignatureDialog.tsx @@ -1,23 +1,23 @@ -import { useCallback, useMemo, useRef } from 'react'; import { Dialog } from 'primereact/dialog'; +import { useCallback, useEffect, useMemo, useRef } from 'react'; -import { OutCommand } from '@/hooks/Mapper/types/mapHandlers.ts'; -import { CommandLinkSignatureToSystem, SignatureGroup, SystemSignature, TimeStatus } from '@/hooks/Mapper/types'; -import { useMapRootState } from '@/hooks/Mapper/mapRootProvider'; -import { SystemSignaturesContent } from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/SystemSignaturesContent'; -import { parseSignatureCustomInfo } from '@/hooks/Mapper/helpers/parseSignatureCustomInfo'; -import { getWhSize } from '@/hooks/Mapper/helpers/getWhSize'; import { useSystemInfo } from '@/hooks/Mapper/components/hooks'; import { SOLAR_SYSTEM_CLASS_IDS, SOLAR_SYSTEM_CLASSES_TO_CLASS_GROUPS, WORMHOLES_ADDITIONAL_INFO_BY_SHORT_NAME, } from '@/hooks/Mapper/components/map/constants.ts'; -import { K162_TYPES_MAP } from '@/hooks/Mapper/constants.ts'; import { SETTINGS_KEYS, SignatureSettingsType, } from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/constants.ts'; +import { SystemSignaturesContent } from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/SystemSignaturesContent'; +import { K162_TYPES_MAP } from '@/hooks/Mapper/constants.ts'; +import { getWhSize } from '@/hooks/Mapper/helpers/getWhSize'; +import { parseSignatureCustomInfo } from '@/hooks/Mapper/helpers/parseSignatureCustomInfo'; +import { useMapRootState } from '@/hooks/Mapper/mapRootProvider'; +import { CommandLinkSignatureToSystem, SignatureGroup, SystemSignature, TimeStatus } from '@/hooks/Mapper/types'; +import { OutCommand } from '@/hooks/Mapper/types/mapHandlers.ts'; const K162_SIGNATURE_TYPE = WORMHOLES_ADDITIONAL_INFO_BY_SHORT_NAME['K162'].shortName; @@ -49,7 +49,9 @@ export const SystemLinkSignatureDialog = ({ data, setVisible }: SystemLinkSignat ref.current = { outCommand }; // Get system info for the target system - const { staticInfo: targetSystemInfo } = useSystemInfo({ systemId: `${data.solar_system_target}` }); + const { staticInfo: targetSystemInfo, dynamicInfo: targetSystemDynamicInfo } = useSystemInfo({ + systemId: `${data.solar_system_target}`, + }); // Get the system class group for the target system const targetSystemClassGroup = useMemo(() => { @@ -160,6 +162,12 @@ export const SystemLinkSignatureDialog = ({ data, setVisible }: SystemLinkSignat [data, setVisible, wormholes], ); + useEffect(() => { + if (!targetSystemDynamicInfo) { + handleHide(); + } + }, [targetSystemDynamicInfo]); + return ( [], hooksRef: RefObject) => { const handleCommand = useCallback(