Skip to content

Commit

Permalink
Dedupe selected values
Browse files Browse the repository at this point in the history
  • Loading branch information
malwilley committed Sep 20, 2024
1 parent ccae954 commit eb375be
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {Tag, TagCollection} from 'sentry/types/group';
import {trackAnalytics} from 'sentry/utils/analytics';
import {uniq} from 'sentry/utils/array/uniq';
import {type FieldDefinition, FieldValueType} from 'sentry/utils/fields';
import {isCtrlKeyPressed} from 'sentry/utils/isCtrlKeyPressed';
import {keepPreviousData, type QueryKey, useQuery} from 'sentry/utils/queryClient';
Expand Down Expand Up @@ -111,7 +112,11 @@ function prepareInputValueForSaving(valueType: FieldValueType, inputValue: strin
)
.filter(text => text?.length) ?? [];

return values.length > 1 ? `[${values.join(',')}]` : values[0] ?? '""';
const uniqueValues = uniq(values);

return uniqueValues.length > 1
? `[${uniqueValues.join(',')}]`
: uniqueValues[0] ?? '""';
}

function getSelectedValuesFromText(
Expand Down

0 comments on commit eb375be

Please sign in to comment.