Skip to content

Commit

Permalink
fix(n-select): clear createdOptions in clear event
Browse files Browse the repository at this point in the history
  • Loading branch information
Yhspehy committed Dec 27, 2024
1 parent 42fd812 commit f957188
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## NEXT_VERSION

### Fixes

- Fix `n-select` don't clear createdOptions in clear event when `show` is false with `tag`.

## 2.40.3

`2024-12-02`
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- 修复 `n-scrollbar``n-float-button``n-float-button-group``n-popover` 组件中的 `inset` 属性在部分浏览器中有兼容性问题,close [#6604](https://github.com/tusen-ai/naive-ui/issues/6604),close [#6602](https://github.com/tusen-ai/naive-ui/issues/6602)
- 修复 `n-select`在设置tag和show为false的时候,clear无法清除原先生成的标签导致无法选中

## 2.40.3

Expand Down
5 changes: 4 additions & 1 deletion src/select/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,13 @@ export default defineComponent({
}
function handleClear(e: MouseEvent): void {
e.stopPropagation()
const { multiple } = props
const { multiple, tag } = props
if (!multiple && props.filterable) {
closeMenu()
}
if (tag && !mergedShowRef.value) {
createdOptionsRef.value = emptyArray
}
doClear()
if (multiple) {
doUpdateValue([], [])
Expand Down

0 comments on commit f957188

Please sign in to comment.