mirror of https://github.com/sveltejs/svelte
fix: always run `if` block code the first time (#14597)
* fix: always run `if` block code the first time * fixpull/14607/head
parent
08e2cf25b0
commit
1a0b822f48
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: always run `if` block code the first time
|
@ -0,0 +1,15 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
// even {#if true} or {#if false} should be kept as an if block, because it could be {#if browser} originally,
|
||||
// which is then different between client and server.
|
||||
export default test({
|
||||
server_props: {
|
||||
condition: true
|
||||
},
|
||||
|
||||
props: {
|
||||
condition: false
|
||||
},
|
||||
|
||||
trim_whitespace: false
|
||||
});
|
@ -0,0 +1 @@
|
||||
<!--[--><!--[--><!--]--> <div><!----><!----></div> hello<!--]-->
|
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
let { condition } = $props();
|
||||
</script>
|
||||
|
||||
{#if condition}
|
||||
<slot />
|
||||
{/if}
|
||||
|
||||
<div>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
hello
|
@ -0,0 +1 @@
|
||||
<!--[--><!--[!--><p>foo</p><!--]--><!--]-->
|
Loading…
Reference in new issue