Alerting: Fix label value dropdown suggestions in alert rule editor (#113702)

This commit is contained in:
Lauren
2025-11-11 16:40:23 +00:00
committed by GitHub
parent 96f34f8f56
commit c4cf454cf0
@@ -262,13 +262,13 @@ export function LabelsWithSuggestions({ dataSourceName }: LabelsWithSuggestionsP
selectedKey
);
const values = useMemo(() => {
return getValuesForLabel(selectedKey);
}, [selectedKey, getValuesForLabel]);
return (
<Stack direction="column" gap={2} alignItems="flex-start">
{fields.map((field, index) => {
// Get the values for this specific row's key directly without memoization
const currentKey = labelsInSubform[index]?.key || '';
const valuesForCurrentKey = getValuesForLabel(currentKey);
return (
<div key={field.id} className={cx(styles.flexRow, styles.centerAlignRow)} id="hola">
<Field
@@ -320,7 +320,7 @@ export function LabelsWithSuggestions({ dataSourceName }: LabelsWithSuggestionsP
<AlertLabelDropdown
{...rest}
defaultValue={value ? { label: value, value: value } : undefined}
options={values}
options={valuesForCurrentKey}
isLoading={loading}
onChange={(newValue: SelectableValue) => {
if (newValue) {