Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions react/LocationCountry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const LocationCountry: React.FC<LocationCountryProps> = ({

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`
)
Expand All @@ -84,7 +84,7 @@ const LocationCountry: React.FC<LocationCountryProps> = ({
}, [country, setAddress])

// Do not render anything if we only have 1 country or none.
if (countries.length <= 1) {
if ((countries ?? []).length <= 1) {
return null
}

Expand Down