From 34978ef5e7233d2907f50cc89e54223135bb9866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Szyma=C5=84ski?= Date: Thu, 5 Dec 2019 10:35:16 +0100 Subject: [PATCH] Fix issue with country sorting on shipping page --- src/components/CountryList/CountryList.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/CountryList/CountryList.tsx b/src/components/CountryList/CountryList.tsx index 5db73c650..a47bf996c 100644 --- a/src/components/CountryList/CountryList.tsx +++ b/src/components/CountryList/CountryList.tsx @@ -89,6 +89,10 @@ const CountryList: React.FC = props => { const [isCollapsed, setCollapseStatus] = React.useState(true); const toggleCollapse = () => setCollapseStatus(!isCollapsed); + function sortCountries(countries: CountryFragment[]): CountryFragment[] { + return [...countries].sort((a, b) => a.country.localeCompare(b.country)); + } + return ( = props => { {!isCollapsed && renderCollection( - countries, + sortCountries(countries), (country, countryIndex) => (