Skip to content

Commit

Permalink
fix(LemonInputSelect): remove all escaped commas (#25646)
Browse files Browse the repository at this point in the history
  • Loading branch information
skoob13 authored Oct 17, 2024
1 parent cb1b316 commit 94f3b36
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function LemonInputSelect({
// Show the input value if custom values are allowed and it's not in the list
if (inputValue && !values.includes(inputValue)) {
if (allowCustomValues) {
const unescapedInputValue = inputValue.replace('\\,', ',') // Transform escaped commas to plain commas
const unescapedInputValue = inputValue.replaceAll('\\,', ',') // Transform escaped commas to plain commas
ret.push({ key: unescapedInputValue, label: unescapedInputValue, __isInput: true })
}
} else if (mode === 'single' && values.length > 0) {
Expand Down Expand Up @@ -164,7 +164,7 @@ export function LemonInputSelect({

// We split on commas EXCEPT if they're escaped (to allow for commas in values)
newValue.split(NON_ESCAPED_COMMA_REGEX).forEach((value) => {
const trimmedValue = value.replace('\\,', ',').trim() // Transform escaped commas to plain commas
const trimmedValue = value.replaceAll('\\,', ',').trim() // Transform escaped commas to plain commas
if (trimmedValue && !values.includes(trimmedValue)) {
newValues.push(trimmedValue)
}
Expand Down

0 comments on commit 94f3b36

Please sign in to comment.