Skip to content
Snippets Groups Projects
Commit 89cc8854 authored by Johannes Baiter's avatar Johannes Baiter
Browse files

Fix undesired resets of content search query

Previously, this would happen anytime the input was blurred (fixed by
setting the `freeSolo` prop) and for some reason after a re-render,
triggered by the `useAutocomplete` hook in MUI (fixed by ignoring
updates with an empty value and a 'reset' reason).
parent 8218a6b0
Branches
No related tags found
No related merge requests found
......@@ -41,6 +41,11 @@ export class SearchPanelControls extends Component {
/** */
handleChange(event, value, reason) {
// For some reason the value gets reset to an empty value from the
// useAutocomplete hook sometimes, we just ignore these cases
if (reason === 'reset' && !value) {
return;
}
this.setState({
search: value,
suggestions: [],
......@@ -121,6 +126,7 @@ export class SearchPanelControls extends Component {
noOptionsText=""
onChange={this.selectItem}
onInputChange={this.handleChange}
freeSolo={true}
renderInput={params => (
<TextField
{...params}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment