mirror of https://github.com/sveltejs/svelte
set/unset parent component correctly in SSR - fixes #2182
parent
81d33a2fb0
commit
138e5b6709
@ -0,0 +1,8 @@
|
|||||||
|
<script>
|
||||||
|
import { getContext } from 'svelte';
|
||||||
|
import { ID } from './Nested.svelte';
|
||||||
|
|
||||||
|
const name = getContext('test');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>{name}</div>
|
@ -0,0 +1,10 @@
|
|||||||
|
<script>
|
||||||
|
import { getContext, setContext } from 'svelte';
|
||||||
|
|
||||||
|
export let name = '';
|
||||||
|
|
||||||
|
const parentName = getContext('test');
|
||||||
|
setContext('test', parentName ? parentName + '/' + name : name);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<slot></slot>
|
@ -0,0 +1,6 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<div>foo/bar</div>
|
||||||
|
<div>foo/baz</div>
|
||||||
|
`
|
||||||
|
};
|
@ -0,0 +1,13 @@
|
|||||||
|
<script>
|
||||||
|
import Nested from './Nested.svelte';
|
||||||
|
import Leaf from './Leaf.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Nested name='foo'>
|
||||||
|
<Nested name='bar'>
|
||||||
|
<Leaf/>
|
||||||
|
</Nested>
|
||||||
|
<Nested name='baz'>
|
||||||
|
<Leaf/>
|
||||||
|
</Nested>
|
||||||
|
</Nested>
|
Loading…
Reference in new issue