Skip to content

Commit d2580cc

Browse files
committed
refactor(omi): props.children have lower priority and coverage mode
1 parent a3143a0 commit d2580cc

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

packages/omi/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "omi",
3-
"version": "7.5.5",
3+
"version": "7.5.6",
44
"scripts": {
55
"start": "vite",
66
"dev-vite": "vite",

packages/omi/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ export { Signal } from './signal'
1818
export { css } from './css-tag'
1919
export { mixin } from './options'
2020
export { registerDirective } from './directive'
21-
export const version = '7.5.5'
21+
export const version = '7.5.6'

packages/omi/src/vdom.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ export function createElement(
4343
...restChildren: VNode[] | unknown[]
4444
): VNode | VNode[] {
4545
let children: VNode[] | undefined
46-
if (arguments.length > 2) {
47-
children = restChildren.flat() as VNode[]
48-
}
4946

5047
// jsx 嵌套的元素自动忽略 attrs
5148
if (attributes) {
@@ -54,12 +51,10 @@ export function createElement(
5451
attributes = { ignoreAttrs: true }
5552
}
5653

57-
if (attributes.children != null) {
58-
if (children) {
59-
children.push(...(attributes.children as VNode[]))
60-
} else {
61-
children = attributes.children as VNode[]
62-
}
54+
if (arguments.length > 2) {
55+
children = restChildren.flat() as VNode[]
56+
} else if (attributes.children != null) {
57+
children = attributes.children as VNode[]
6358
delete attributes.children
6459
}
6560

0 commit comments

Comments
 (0)