Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Combobox] Infinite render loop when input is whitespace on controlled combobox #481

Closed
jbachhardie opened this issue Feb 20, 2020 · 2 comments
Labels
Type: Bug Something isn't working

Comments

@jbachhardie
Copy link

πŸ› Bug report

Current Behavior

When a controlled Combobox receives a value prop that is just whitespace β€” e.g " " β€” it crashes with a "Maximum update depth exceeded" error,

Expected behavior

The input is rendered with a value equal to the one passed in without crashing.

Reproducible example

https://codesandbox.io/s/musing-thunder-rmzvv

Suggested solution(s)

The problem is due to ComboboxInput triggering a change on isControlled && controlledValue !== value (line 462) but then deciding whether the input is cleared with value.trim() === "" (line 447). Either both of these comparisons have to .trim() the value or neither, not sure what the most appropriate would be but the discrepancy makes the loop infinite.

Additional context

Your environment

Software Name(s) Version
Reach Package @reach/combobox 0.8.4
React 16.11.0
Browser Multiple
Assistive tech N/A
Node N/A
npm/yarn yarn 1.19.1
Operating System Multiple
@enforce-template-use
Copy link

Thank you for opening this issue

@chaance chaance added the Type: Bug Something isn't working label Feb 20, 2020
@chaance
Copy link
Member

chaance commented Feb 21, 2020

Fixed in 0.8.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants