Skip to content

Commit

Permalink
combobox: fix infinite loop bug (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance committed Feb 21, 2020
1 parent 68f528d commit 3d1f08d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/combobox/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,12 @@ export const ComboboxInput = forwardRefWithAs<ComboboxInputProps, "input">(
// If they are controlling the value we still need to do our transitions, so
// we have this derived state to emulate onChange of the input as we receive
// new `value`s ...[*]
if (isControlled && controlledValue !== value) {
if (
isControlled &&
controlledValue !== value &&
// https://github.com/reach/reach-ui/issues/481
(controlledValue!.trim() === "" ? (value || "").trim() !== "" : true)
) {
handleValueChange(controlledValue!);
}

Expand Down

0 comments on commit 3d1f08d

Please sign in to comment.