Skip to content

Commit e42ff1b

Browse files
committed
chore: update
1 parent 7a4a4c0 commit e42ff1b

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

packages/compiler-vapor/__tests__/transforms/__snapshots__/TransformTransition.spec.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@ exports[`compiler: transition > v-show + appear 1`] = `
7474
const t0 = _template("<h1>foo</h1>")
7575
7676
export function render(_ctx) {
77-
const lazyApplyVShowFn = []
77+
const deferredApplyVShows = []
7878
const n1 = _createComponent(_VaporTransition, {
7979
appear: () => (""),
8080
persisted: () => ("")
8181
}, {
8282
"default": () => {
8383
const n0 = t0()
84-
lazyApplyVShowFn.push(() => _applyVShow(n0, () => (_ctx.show)))
84+
deferredApplyVShows.push(() => _applyVShow(n0, () => (_ctx.show)))
8585
return n0
8686
}
8787
}, true)
88-
lazyApplyVShowFn.forEach(fn => fn())
88+
deferredApplyVShows.forEach(fn => fn())
8989
return n1
9090
}"
9191
`;

packages/compiler-vapor/src/generators/block.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export function genBlockContent(
4444
const { dynamic, effect, operation, returns, key } = block
4545
const resetBlock = context.enterBlock(block)
4646

47-
if (block.hasLazyApplyVShow) {
48-
push(NEWLINE, `const lazyApplyVShowFn = []`)
47+
if (block.hasDeferredVShow) {
48+
push(NEWLINE, `const deferredApplyVShows = []`)
4949
}
5050

5151
if (root) {
@@ -60,8 +60,8 @@ export function genBlockContent(
6060
push(...genOperations(operation, context))
6161
push(...genEffects(effect, context))
6262

63-
if (block.hasLazyApplyVShow) {
64-
push(NEWLINE, `lazyApplyVShowFn.forEach(fn => fn())`)
63+
if (block.hasDeferredVShow) {
64+
push(NEWLINE, `deferredApplyVShows.forEach(fn => fn())`)
6565
}
6666

6767
if (dynamic.needsKey) {

packages/compiler-vapor/src/generators/vShow.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ export function genVShow(
77
oper: DirectiveIRNode,
88
context: CodegenContext,
99
): CodeFragment[] {
10-
const { lazy, element } = oper
10+
const { deferred, element } = oper
1111
return [
1212
NEWLINE,
13-
lazy ? `lazyApplyVShowFn.push(() => ` : undefined,
13+
deferred ? `deferredApplyVShows.push(() => ` : undefined,
1414
...genCall(context.helper('applyVShow'), `n${element}`, [
1515
`() => (`,
1616
...genExpression(oper.dir.exp!, context),
1717
`)`,
1818
]),
19-
lazy ? `)` : undefined,
19+
deferred ? `)` : undefined,
2020
]
2121
}

packages/compiler-vapor/src/ir/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface BlockIRNode extends BaseIRNode {
5656
operation: OperationNode[]
5757
expressions: SimpleExpressionNode[]
5858
returns: number[]
59-
hasLazyApplyVShow: boolean
59+
hasDeferredVShow: boolean
6060
}
6161

6262
export interface RootIRNode {
@@ -188,7 +188,7 @@ export interface DirectiveIRNode extends BaseIRNode {
188188
builtin?: boolean
189189
asset?: boolean
190190
modelType?: 'text' | 'dynamic' | 'radio' | 'checkbox' | 'select'
191-
lazy?: boolean
191+
deferred?: boolean
192192
}
193193

194194
export interface CreateComponentIRNode extends BaseIRNode {

packages/compiler-vapor/src/transforms/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const newBlock = (node: BlockIRNode['node']): BlockIRNode => ({
3131
returns: [],
3232
expressions: [],
3333
tempId: 0,
34-
hasLazyApplyVShow: false,
34+
hasDeferredVShow: false,
3535
})
3636

3737
export function wrapTemplate(node: ElementNode, dirs: string[]): TemplateNode {

packages/compiler-vapor/src/transforms/vShow.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ export const transformVShow: DirectiveTransform = (dir, node, context) => {
3030
}
3131

3232
// lazy apply vshow if the node is inside a transition with appear
33-
let lazyApplyVShow = false
33+
let shouldDeferred = false
3434
const parentNode = context.parent && context.parent.node
3535
if (parentNode && parentNode.type === NodeTypes.ELEMENT) {
36-
lazyApplyVShow = !!(
36+
shouldDeferred = !!(
3737
isTransitionTag(parentNode.tag) &&
3838
findProp(parentNode, 'appear', false, true)
3939
)
4040

41-
if (lazyApplyVShow) {
42-
context.parent!.parent!.block.hasLazyApplyVShow = true
41+
if (shouldDeferred) {
42+
context.parent!.parent!.block.hasDeferredVShow = true
4343
}
4444
}
4545

@@ -49,6 +49,6 @@ export const transformVShow: DirectiveTransform = (dir, node, context) => {
4949
dir,
5050
name: 'show',
5151
builtin: true,
52-
lazy: lazyApplyVShow,
52+
deferred: shouldDeferred,
5353
})
5454
}

0 commit comments

Comments
 (0)