Skip to content

Commit 2bdc3d4

Browse files
authored
fix: ensure compiler statements are correctly included (#14074)
Fixes #14068 and fixes #14071
1 parent 3b38bc2 commit 2bdc3d4

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

.changeset/nice-peas-lay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: ensure compiler statements are correctly included

packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ export function RegularElement(node, context) {
401401
context.state.init.push(
402402
b.block([
403403
...child_state.init,
404+
...element_state.init,
404405
child_state.update.length > 0 ? build_render_statement(child_state.update) : b.empty,
405406
...child_state.after_update,
406407
...element_state.after_update
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { test } from '../../test';
2+
3+
export default test({
4+
compileOptions: {
5+
dev: true // Render in dev mode to check that the validation error is not thrown
6+
},
7+
html: `<form></form>\nundefined`
8+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script>
2+
let thisBug;
3+
</script>
4+
5+
<form bind:this={thisBug}>
6+
{#snippet Bug()}
7+
cool
8+
{/snippet}
9+
</form>
10+
11+
{typeof thisBug}

0 commit comments

Comments
 (0)