From 5b33845a7f61ec1e879997d0712b07cebd29c567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 6 Jun 2018 16:48:02 +0200 Subject: [PATCH] fix mutating the store accounts! btw in future we should just pass option to the Select so we don't need to .map --- src/components/SelectAccount/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/SelectAccount/index.js b/src/components/SelectAccount/index.js index 28584255..b041ffd7 100644 --- a/src/components/SelectAccount/index.js +++ b/src/components/SelectAccount/index.js @@ -57,9 +57,7 @@ type Props = { } const RawSelectAccount = ({ accounts, onChange, value, t, ...props }: Props) => { - const options = accounts - .sort((a, b) => (a.name < b.name ? -1 : 1)) - .map(a => ({ ...a, value: a.id, label: a.name })) + const options = accounts.map(a => ({ ...a, value: a.id, label: a.name })) const selectedOption = value ? options.find(o => o.value === value.id) : null return (