Skip to content

Commit

Permalink
formik bug fix hack
Browse files Browse the repository at this point in the history
  • Loading branch information
b-cooper committed Dec 13, 2023
1 parent 4b747ef commit d5f3729
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ function PipetteTipsField(props: PipetteTipsFieldProps): JSX.Element | null {

React.useEffect(() => {
if (currentValue === undefined) {
setFieldValue(nameAccessor, tiprackOptions[0]?.value ?? '')
// this timeout avoids an infinite loop caused by Formik and React 18 not playing nice
// see https://github.com/downshift-js/downshift/issues/1511
// TODO: migrate away from formik
setTimeout(() => {
setFieldValue(nameAccessor, tiprackOptions[0]?.value ?? '')
})
}
}, [currentValue, setFieldValue, nameAccessor, tiprackOptions])

Expand Down

0 comments on commit d5f3729

Please sign in to comment.