Skip to content

Commit f8fe085

Browse files
committed
fix(compiler-core): properly track scope vars in v-for + slot
1 parent e3bc21f commit f8fe085

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/compiler-core/src/transforms/vSlot.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,13 @@ export function buildSlots(
201201
hasDynamicSlots = true
202202
}
203203

204+
let onExit
205+
if(!__BROWSER__ && context.prefixIdentifiers){
206+
onExit = trackVForSlotScopes(slotElement, context) as () => void
207+
}
204208
const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc)
209+
onExit && onExit()
210+
205211
// check if this slot is conditional (v-if/v-for)
206212
let vIf: DirectiveNode | undefined
207213
let vElse: DirectiveNode | undefined

packages/compiler-ssr/__tests__/ssrComponent.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ describe('ssr: components', () => {
201201
_push(\`\${_ssrInterpolate(msg + key + _ctx.bar)}\`)
202202
} else {
203203
return [
204-
_createTextVNode(_toDisplayString(msg + _ctx.key + _ctx.bar), 1 /* TEXT */)
204+
_createTextVNode(_toDisplayString(msg + key + _ctx.bar), 1 /* TEXT */)
205205
]
206206
}
207207
})

0 commit comments

Comments
 (0)