Skip to content

Commit

Permalink
Change TagsInput onRemove to copy correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ctdunc committed Nov 9, 2024
1 parent fbcee92 commit 9af1918
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/@mantine/core/src/components/TagsInput/TagsInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ export const TagsInput = factory<TagsInputFactory>((_props, ref) => {
if ((!isDuplicate || (isDuplicate && allowDuplicates)) && _value.length < maxTags!) {
onOptionSubmit?.(val);
setSearchValue('');

if (val.length > 0) {
setValue([..._value, val]);
}
Expand Down Expand Up @@ -336,8 +335,9 @@ export const TagsInput = factory<TagsInputFactory>((_props, ref) => {
key={`${item}-${index}`}
withRemoveButton={!readOnly}
onRemove={() => {
_value.splice(index, 1);
setValue([..._value]);
const next_value = _value.slice();
next_value.splice(index, 1);
setValue(next_value);
onRemove?.(item);
}}
unstyled={unstyled}
Expand Down

0 comments on commit 9af1918

Please sign in to comment.