Skip to content

Commit

Permalink
Avoid remounting automcompleters
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jun 19, 2020
1 parent 1050f11 commit 73dbcd3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/components/src/autocomplete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const getAutoCompleterUI = ( autocompleter ) => {
}
const keyedOptions = optionsData.map(
( optionData, optionIndex ) => ( {
key: `${ autocompleter.idx }-${ optionIndex }`,
key: `${ autocompleter.name }-${ optionIndex }`,
value: optionData,
label: autocompleter.getOptionLabel(
optionData
Expand Down Expand Up @@ -442,12 +442,8 @@ export class Autocomplete extends Component {
const textAfterSelection = getTextContent(
slice( record, undefined, getTextContent( record ).length )
);
const allCompleters = map( completers, ( completer, idx ) => ( {
...completer,
idx,
} ) );
const autocompleter = find(
allCompleters,
completers,
( { triggerPrefix, allowContext } ) => {
const index = text.lastIndexOf( triggerPrefix );

Expand Down

0 comments on commit 73dbcd3

Please sign in to comment.