Skip to content

Commit

Permalink
revert(space): omitting comment VNode in space (#5172)
Browse files Browse the repository at this point in the history
  • Loading branch information
equt authored Aug 23, 2023
1 parent 597fd57 commit bd995ab
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
- Fix `n-tree`'s `TreeOption`'s `checkboxDisabled` prop doesn't work when `check-on-click` is `true`.
- Fix rapid clicks on `n-date-input`'s buttons triggering a text select for the rest of the website.
- Fix `n-auto-complete`'s autocomplete menu's unexpected open when clicking the clear icon with the input not focused, closes [#4658](https://github.com/tusen-ai/naive-ui/issues/4658).
- Fix `n-input`'s `on-keyup` prop type, closes [#5101](https://github.com/tusen-ai/naive-ui/issues/5101).
- Fix `n-space` vnode reuse problem caused by filtering out comment vnodes of slot, closes [#5136](https://github.com/tusen-ai/naive-ui/issues/5136).
- Fix `n-input`'s `on-keyup` prop type, closes [#5101](https://github.com/tusen-ai/naive-ui/issues/5101)

### Features

Expand Down
1 change: 0 additions & 1 deletion CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
- 修复 `n-date-input` 的按钮快速点击时网站其余文本会被选中
- 修复 `n-auto-complete` 在未聚焦状态下点击清除按钮时补全菜单意外打开的问题,关闭 [#4658](https://github.com/tusen-ai/naive-ui/issues/4658)
- 修复 `n-input` 属性 `on-keyup` 类型,关闭 [#5101](https://github.com/tusen-ai/naive-ui/issues/5101)
- 修复 `n-space` 插槽过滤了注释节点导致节点复用问题,关闭 [#5136](https://github.com/tusen-ai/naive-ui/issues/5136)

### Features

Expand Down
3 changes: 1 addition & 2 deletions src/_utils/vue/flatten.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export function flatten (
flatten(vNode.children, filterCommentNode, result)
}
// rawSlot
} else {
if (vNode.type === Comment && filterCommentNode) return
} else if (vNode.type !== Comment) {
result.push(vNode)
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/space/src/Space.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default defineComponent({
wrapItem,
internalUseGap
} = this
const children = flatten(getSlot(this), false)
const children = flatten(getSlot(this))
if (!children.length) return null
const horizontalMargin = `${margin.horizontal}px`
const semiHorizontalMargin = `${margin.horizontal / 2}px`
Expand Down

0 comments on commit bd995ab

Please sign in to comment.