Skip to content

Commit 95a4e71

Browse files
committed
fix: workaround to address the pl-search autocomplete not displaying results the first time the component is focused
1 parent ac8f7c7 commit 95a4e71

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/uikit-workshop/src/scripts/components/pl-search/pl-search.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ class Search extends BaseComponent {
7575
clearButtonText: props.string,
7676
};
7777

78+
onInput = e => {
79+
let value = e.target.value;
80+
81+
this.setState({
82+
value: value,
83+
});
84+
85+
this.onSuggestionsFetchRequested({ value }); // re-render search results immediately based on latest input value
86+
};
87+
7888
// External Redux store not yet in use
7989
_stateChanged(state) {}
8090

@@ -325,6 +335,7 @@ class Search extends BaseComponent {
325335
: 'Find a Pattern',
326336
value,
327337
onChange: this.onChange,
338+
onInput: this.onInput,
328339
};
329340

330341
return (

0 commit comments

Comments
 (0)