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$,