From e4c14886361c7914ba29bf6da4b2db773ed84fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Mon, 5 Oct 2020 17:42:19 +0200 Subject: [PATCH] fix(js): support `onStateChange` --- packages/autocomplete-core/src/utils.ts | 1 - packages/autocomplete-js/src/autocomplete.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/autocomplete-core/src/utils.ts b/packages/autocomplete-core/src/utils.ts index 98d52987c..9a39780fa 100644 --- a/packages/autocomplete-core/src/utils.ts +++ b/packages/autocomplete-core/src/utils.ts @@ -131,7 +131,6 @@ function getSuggestionFromHighlightedIndex({ * [['a', 'b'], ['c', 'd', 'e'], ['f']] * ↑ * (absolute: 3, relative: 1) - * @param param0 */ function getRelativeHighlightedIndex({ state, diff --git a/packages/autocomplete-js/src/autocomplete.ts b/packages/autocomplete-js/src/autocomplete.ts index 404cb5560..531321403 100644 --- a/packages/autocomplete-js/src/autocomplete.ts +++ b/packages/autocomplete-js/src/autocomplete.ts @@ -40,6 +40,7 @@ export function autocomplete({ const dropdown = document.createElement('div'); const autocomplete = createAutocomplete({ + ...props, onStateChange(options) { const { state } = options; render(state as any); @@ -48,7 +49,6 @@ export function autocomplete({ props.onStateChange(options); } }, - ...props, }); const onResize = debounce(() => {