diff --git a/src/containers/floating/Settings/sections/p2p/P2PConnectionData.tsx b/src/containers/floating/Settings/sections/p2p/P2PConnectionData.tsx index 04a4f1bc8..7667b6860 100644 --- a/src/containers/floating/Settings/sections/p2p/P2PConnectionData.tsx +++ b/src/containers/floating/Settings/sections/p2p/P2PConnectionData.tsx @@ -21,7 +21,7 @@ export default function P2PConnectionData() { const [copiedId, setCopiedId] = useState(); const { copyToClipboard } = useCopyToClipboard(); - const connectionInfo = useP2poolStatsStore((s) => s.connection_info); + const connectionInfo = useP2poolStatsStore((s) => s?.connection_info); useEffect(() => { if (copiedId) { diff --git a/src/containers/floating/Settings/sections/p2p/P2PoolStats.tsx b/src/containers/floating/Settings/sections/p2p/P2PoolStats.tsx index 0a2c2851f..3d1a87f22 100644 --- a/src/containers/floating/Settings/sections/p2p/P2PoolStats.tsx +++ b/src/containers/floating/Settings/sections/p2p/P2PoolStats.tsx @@ -23,8 +23,8 @@ export type ConnectedPeerInfoExtended = ConnectedPeerInfo & { const P2PoolStats = () => { const { t } = useTranslation('p2p', { useSuspense: false }); - const connectedSince = useP2poolStatsStore((s) => s.connected_since); - const connectionInfo = useP2poolStatsStore((s) => s.connection_info); + const connectedSince = useP2poolStatsStore((s) => s?.connected_since); + const connectionInfo = useP2poolStatsStore((s) => s?.connection_info); const sha3Stats = useP2poolStatsStore((s) => s?.sha3x_stats); const randomXStats = useP2poolStatsStore((s) => s?.randomx_stats); const peers = useP2poolStatsStore((s) => s?.peers); diff --git a/src/store/useP2poolStatsStore.ts b/src/store/useP2poolStatsStore.ts index bf76c421d..615c1eb85 100644 --- a/src/store/useP2poolStatsStore.ts +++ b/src/store/useP2poolStatsStore.ts @@ -2,7 +2,7 @@ import { invoke } from '@tauri-apps/api'; import { create } from './create'; import { P2poolConnections, P2poolStats, P2poolStatsResult } from '../types/app-status.ts'; -type State = Partial; +type State = Partial & Partial; interface Actions { randomx_stats?: P2poolStats;