From e1f1ca955999d3328abcf18010fa56f3490bd077 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 4 Mar 2025 16:43:38 -0700 Subject: [PATCH] [controls] fix Korean characters split into 2 characters with space in between when typing in options list search input (#213164) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes https://github.com/elastic/kibana/issues/213150 Test steps * Follow https://www.youtube.com/watch?v=vjulSf3Kwu4 to setup duel language inputs with English and Korean. * Create a dashboard with an options list. Switch to Korean input and type in option list control. Type the characters `d` and `k` on an english keyboard. * Ensure input treats value as a single character. Screenshot 2025-03-04 at 1 52 14 PM --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 3ce9019ce3260d9155827edd97bb80dea439bc5a) --- .../publishing_subject/publishing_batcher.ts | 2 ++ .../components/options_list_popover_action_bar.tsx | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/platform/packages/shared/presentation/presentation_publishing/publishing_subject/publishing_batcher.ts b/src/platform/packages/shared/presentation/presentation_publishing/publishing_subject/publishing_batcher.ts index 1a84e860907c2..c594cb5a76c28 100644 --- a/src/platform/packages/shared/presentation/presentation_publishing/publishing_subject/publishing_batcher.ts +++ b/src/platform/packages/shared/presentation/presentation_publishing/publishing_subject/publishing_batcher.ts @@ -102,6 +102,8 @@ export const useBatchedOptionalPublishingSubjects = < * Batches the latest values of multiple publishing subjects into a single object. Use this to avoid unnecessary re-renders. * Use when `subjects` are static and do not change over the lifetime of the component. * + * Do not use when value is used as an input value to avoid debouncing user interactions + * * @param subjects Publishing subjects array. */ export const useBatchedPublishingSubjects = < diff --git a/src/platform/plugins/shared/controls/public/controls/data_controls/options_list_control/components/options_list_popover_action_bar.tsx b/src/platform/plugins/shared/controls/public/controls/data_controls/options_list_control/components/options_list_popover_action_bar.tsx index ccf0ce857b783..5f1a420956b62 100644 --- a/src/platform/plugins/shared/controls/public/controls/data_controls/options_list_control/components/options_list_popover_action_bar.tsx +++ b/src/platform/plugins/shared/controls/public/controls/data_controls/options_list_control/components/options_list_popover_action_bar.tsx @@ -18,7 +18,10 @@ import { EuiText, EuiToolTip, } from '@elastic/eui'; -import { useBatchedPublishingSubjects } from '@kbn/presentation-publishing'; +import { + useBatchedPublishingSubjects, + useStateFromPublishingSubject, +} from '@kbn/presentation-publishing'; import { getCompatibleSearchTechniques } from '../../../../../common/options_list/suggestions_searching'; import { useOptionsListContext } from '../options_list_context_provider'; @@ -36,8 +39,11 @@ export const OptionsListPopoverActionBar = ({ }: OptionsListPopoverProps) => { const { api, stateManager, displaySettings } = useOptionsListContext(); + // Using useStateFromPublishingSubject instead of useBatchedPublishingSubjects + // to avoid debouncing input value + const searchString = useStateFromPublishingSubject(stateManager.searchString); + const [ - searchString, searchTechnique, searchStringValid, invalidSelections, @@ -45,7 +51,6 @@ export const OptionsListPopoverActionBar = ({ field, allowExpensiveQueries, ] = useBatchedPublishingSubjects( - stateManager.searchString, stateManager.searchTechnique, stateManager.searchStringValid, api.invalidSelections$,