Skip to content

Commit d12a086

Browse files
committed
fix(compiler): move next, child and nthChild before the setInsertionState
1 parent 0cc97d8 commit d12a086

File tree

6 files changed

+185
-177
lines changed

6 files changed

+185
-177
lines changed

docs/introduction/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ We assume you are already familiar with the basic usages of Vue before you conti
1717
pnpm add vue-jsx-vapor
1818

1919
# runtime
20-
pnpm add https://pkg.pr.new/vue@ce35a8c
20+
pnpm add https://pkg.pr.new/vue@13061
2121
```
2222

2323
The Vue Vapor runtime is not release, so we use [pkg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new) to install.
@@ -64,6 +64,6 @@ export default {
6464

6565
:::
6666

67-
<!-- ## Templates
67+
## Templates
6868

69-
- [Vite](https://github.com/vue-macros/vite) -->
69+
- [Vite](https://github.com/zhiyuanzmj/vitesse-jsx-vapor)

packages/compiler/src/transforms/vOn.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ export const transformVOn: DirectiveTransform = (dir, node, context) => {
7979
key: arg,
8080
value: handler,
8181
handler: true,
82-
handlerModifiers: eventOptionModifiers,
82+
handlerModifiers: {
83+
keys: keyModifiers,
84+
nonKeys: nonKeyModifiers,
85+
options: eventOptionModifiers,
86+
},
8387
}
8488
}
8589

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`compile > setInsertionState > next, child and nthChild should be above the setInsertionState 1`] = `
4+
"
5+
const n3 = t0()
6+
const n2 = _next(_child(n3))
7+
const p0 = _nthChild(n3, 4)
8+
const n1 = _child(p0)
9+
_setInsertionState(n3, n2)
10+
const n0 = _createComponent(Comp)
11+
_renderEffect(() => _setProp(n1, "disabled", foo))
12+
return n3
13+
"
14+
`;

packages/compiler/test/compile.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,21 @@ describe('compile', () => {
8585
expect(code).contains('a + b')
8686
})
8787
})
88+
89+
describe('setInsertionState', () => {
90+
test('next, child and nthChild should be above the setInsertionState', () => {
91+
const { code } = compile(`
92+
<div>
93+
<div />
94+
<Comp />
95+
<div />
96+
<div v-if={true} />
97+
<div>
98+
<button disabled={foo} />
99+
</div>
100+
</div>
101+
`)
102+
expect(code).toMatchSnapshot()
103+
})
104+
})
88105
})

0 commit comments

Comments
 (0)