From 3b022fda1979c66d3dd17cf2a972cc88e6a3ba8f Mon Sep 17 00:00:00 2001 From: Sahan Jayawardana Date: Mon, 1 Aug 2022 18:50:36 +0530 Subject: [PATCH 1/2] Fix undefined country list --- CHANGELOG.md | 4 ++++ react/LocationCountry.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f92145..2e18f87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- Fixed undefined country list + ## [0.15.0] - 2021-04-26 ### Added diff --git a/react/LocationCountry.tsx b/react/LocationCountry.tsx index d0e9496..fff0f64 100644 --- a/react/LocationCountry.tsx +++ b/react/LocationCountry.tsx @@ -84,7 +84,7 @@ const LocationCountry: React.FC = ({ }, [country, setAddress]) // Do not render anything if we only have 1 country or none. - if (countries.length <= 1) { + if ((countries ?? []).length <= 1) { return null } From b41d3f0288a842bfd39797c01551b2b3277e4328 Mon Sep 17 00:00:00 2001 From: Jayendra Kumara Date: Sun, 28 May 2023 19:12:23 -0500 Subject: [PATCH 2/2] fix issue location countriy doesn't have counties spacified --- react/LocationCountry.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/LocationCountry.tsx b/react/LocationCountry.tsx index fff0f64..9503380 100644 --- a/react/LocationCountry.tsx +++ b/react/LocationCountry.tsx @@ -60,7 +60,7 @@ const LocationCountry: React.FC = ({ const [country, setCountry] = useState(useCountry()) - if (country && countries && !countries.includes(country)) { + if (country && countries && countries.length > 0 && !countries.includes(country)) { throw new Error( `The country "${country}" doesn't belong to the country list, can't render LocationCountry` )