From 73dbcd3a31e62f2fb5e5f5ba694e2e83cbc8a50a Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 19 Jun 2020 13:44:57 +0100 Subject: [PATCH] Avoid remounting automcompleters --- packages/components/src/autocomplete/index.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/components/src/autocomplete/index.js b/packages/components/src/autocomplete/index.js index f2028f3b06ff4..86cdcb7786e3a 100644 --- a/packages/components/src/autocomplete/index.js +++ b/packages/components/src/autocomplete/index.js @@ -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 @@ -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 );