Skip to content

Commit

Permalink
fix: phantom pill
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-hashimoto committed Dec 12, 2024
1 parent a583a79 commit 31acf1f
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@ export const AutocompleteCellEditor = forwardRef((props, ref) => {
onPaste
} = props

const [selectedValues, setSelectedValues] = useState(
(Array.isArray(value) ? value : value.split(',').map((v) => v.trim())) || []
)
const [selectedValues, setSelectedValues] = useState(() => {
if (!value) {
return []
} else if (Array.isArray(value)) {
return value
} else {
return value.split(',').map((v) => v.trim)
}
})

const inputRef = useRef()

useImperativeHandle(ref, () => ({
Expand Down Expand Up @@ -77,7 +84,7 @@ export const AutocompleteCellEditor = forwardRef((props, ref) => {
if (focusedCell) {
api.startEditingCell({
rowIndex: focusedCell.rowIndex,
colKey: focusedCell.column.getId(),
colKey: focusedCell.column.getId()
})
}
}
Expand All @@ -94,7 +101,6 @@ export const AutocompleteCellEditor = forwardRef((props, ref) => {
}
}


const handleBlur = (event) => {
if (onBlur) {
onBlur(event)
Expand Down

0 comments on commit 31acf1f

Please sign in to comment.