Skip to content

Commit

Permalink
fix: handle null values for country key indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
samshara committed Jan 24, 2024
1 parent 988739b commit 36209e3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/App/routes/CountryRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
useParams,
} from 'react-router-dom';
import { isDefined, isTruthyString } from '@togglecorp/fujs';
mport { countryIdToRegionIdMap } from '#utils/domain/country';
import { countryIdToRegionIdMap } from '#utils/domain/country';

import Auth from '../Auth';
import {
Expand Down
9 changes: 0 additions & 9 deletions src/views/Country/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ export function Component() {

const { isAuthenticated } = useAuth();

const {
pending: aggregatedAppealPending,
response: aggregatedAppealResponse,
} = useRequest({
skip: isNotDefined(countryId) || isRegion,
url: '/api/v2/appeal/aggregated',
query: { country: Number(countryId) },
});

const outletContext = useMemo<CountryOutletContext>(
() => ({
countryId,
Expand Down
6 changes: 3 additions & 3 deletions src/views/CountryProfileOverview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function Component() {
/>
<TextOutput
label={strings.countryIndicatorsUrbanPopulationLabel}
value={`${indicatorResponse?.urban_population} %`}
value={isDefined(indicatorResponse?.urban_population) ? `${indicatorResponse?.urban_population} %` : undefined}
valueType="text"
strongValue
/>
Expand All @@ -63,7 +63,7 @@ export function Component() {
/>
<TextOutput
label={strings.countryIndicatorsPovertyLabel}
value={`${indicatorResponse?.poverty} %`}
value={isDefined(indicatorResponse?.poverty) ? `${indicatorResponse?.poverty} %` : undefined}
valueType="text"
strongValue
/>
Expand All @@ -75,7 +75,7 @@ export function Component() {
/>
<TextOutput
label={strings.countryIndicatorsLiteracyLabel}
value={`${indicatorResponse?.literacy} %`}
value={isDefined(indicatorResponse?.literacy) ? `${indicatorResponse?.literacy} %` : undefined}
valueType="text"
strongValue
/>
Expand Down

0 comments on commit 36209e3

Please sign in to comment.