Browse Source

fix mutating the store accounts!

btw in future we should just pass option to the Select so we don't need to .map
master
Gaëtan Renaudeau 7 years ago
parent
commit
5b33845a7f
  1. 4
      src/components/SelectAccount/index.js

4
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 (
<Select

Loading…
Cancel
Save