Skip to content

Commit

Permalink
fix: Payment Dropdown multiple render fix (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsrivatsa-edinburgh authored Feb 13, 2024
1 parent 6c966f5 commit 56e8cb3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Components/PaymentDropDownField.res
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,19 @@ let make = (
}
React.useEffect1(() => {
let initialValue = options->Belt.Array.get(0)->Belt.Option.getWithDefault("")
if value.value === "" || value.value === initialValue {
if (
value.value === "" ||
value.value === initialValue ||
options->Js.Array2.includes(value.value)->not
) {
setValue(.prev => {
...prev,
isValid: Some(true),
value: initialValue,
})
}
None
}, [options])
}, [options->Belt.Array.get(0)->Belt.Option.getWithDefault("")])
let handleFocus = _ => {
setInputFocused(_ => true)
// setValue(.prev => {
Expand Down

0 comments on commit 56e8cb3

Please sign in to comment.