From fcc840e88349259f274802d90f7acfb91d757d80 Mon Sep 17 00:00:00 2001 From: majakomel Date: Tue, 30 Apr 2024 22:37:29 +0200 Subject: [PATCH] Fix Tor measurement page when testKeys are empty --- components/measurement/nettests/Tor.js | 97 +++++++++++++------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/components/measurement/nettests/Tor.js b/components/measurement/nettests/Tor.js index 9dc4ea400..829a6c203 100644 --- a/components/measurement/nettests/Tor.js +++ b/components/measurement/nettests/Tor.js @@ -1,12 +1,12 @@ -import React, { useMemo, useCallback } from 'react' +import { Flex, Text, theme } from 'ooni-components' +import { Cross, Tick } from 'ooni-components/icons' import PropTypes from 'prop-types' +import React, { useMemo } from 'react' +import { FaClipboard } from 'react-icons/fa' import { FormattedMessage, defineMessages } from 'react-intl' -import { Flex, Text, Container, theme } from 'ooni-components' +import { useSortBy, useTable } from 'react-table' import styled from 'styled-components' -import { useTable, useSortBy } from 'react-table' -import { Cross, Tick } from 'ooni-components/icons' import { useClipboard } from 'use-clipboard-copy' -import { FaClipboard } from 'react-icons/fa' import AccessPointStatus from '../AccessPointStatus' @@ -170,17 +170,14 @@ const TorDetails = ({ summaryText = 'Measurement.Details.SummaryText.Tor.OK' } + const testKeys = measurement?.test_keys || {} const { - or_port_accessible, - or_port_total, or_port_dirauth_accessible, or_port_dirauth_total, obfs4_accessible, obfs4_total, - dir_port_accessible, - dir_port_total, targets = {} - } = measurement.test_keys + } = testKeys const columns = useMemo(() => [ { @@ -236,46 +233,50 @@ const TorDetails = ({ }, details: ( <> - - } - content={ - + + } + content={ + + } + ok={true} + color='blue5' + /> + } + content={ + + } + ok={true} + color='blue5' /> - } - ok={true} - color='blue5' - /> - } - content={ - + + - } - ok={true} - color='blue5' - /> - - -
- + + + } ) })}