diff --git a/packages/grafana-ui/src/components/Segment/SegmentAsync.tsx b/packages/grafana-ui/src/components/Segment/SegmentAsync.tsx index ffe4a60d2d8..b952c38367e 100644 --- a/packages/grafana-ui/src/components/Segment/SegmentAsync.tsx +++ b/packages/grafana-ui/src/components/Segment/SegmentAsync.tsx @@ -13,6 +13,11 @@ import { useStyles } from '../../themes'; export interface SegmentAsyncProps extends SegmentProps, Omit, 'value' | 'onChange'> { value?: T | SelectableValue; loadOptions: (query?: string) => Promise>>; + /** + * If true options will be reloaded when user changes the value in the input, + * otherwise, options will be loaded when the segment is clicked + */ + reloadOptionsOnChange?: boolean; onChange: (item: SelectableValue) => void; noOptionMessageHandler?: (state: AsyncState>>) => string; inputMinWidth?: number; @@ -22,6 +27,7 @@ export function SegmentAsync({ value, onChange, loadOptions, + reloadOptionsOnChange = false, Component, className, allowCustomValue, @@ -45,7 +51,7 @@ export function SegmentAsync({ return (