-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
Context isn't set properly and is undefined on the client side.
Reproduction
WrapperTest.svelte
<script lang="ts">
import { setContext, type Snippet } from "svelte";
let { children }: { children?: Snippet } = $props();
let obj = {};
setContext("test", obj);
</script>
{@render children?.()}Test.svelte
<script lang="ts">
import { getContext } from "svelte";
const test = getContext("test");
console.log(test); // test is undefined;
</script>+page.svelte
<script lang="ts">
import Test from "$components/Test/Test.svelte";
import WrapperTest from "$components/Test/WrapperTest.svelte";
</script>
<WrapperTest>
<Test></Test>
</WrapperTest>Logs
No response
System Info
System:
OS: Windows 11 10.0.22631
CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-12650H
Memory: 7.00 GB / 15.63 GB
Binaries:
Node: 20.12.2 - C:\Program Files\nodejs\node.EXE
npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
bun: 1.1.3 - ~\.bun\bin\bun.EXE
Browsers:
Edge: Chromium (123.0.2420.97)
Internet Explorer: 11.0.22621.3527
npmPackages:
svelte: ^5.0.0-next.121 => 5.0.0-next.121Severity
blocking all usage of svelte
Metadata
Metadata
Assignees
Labels
No labels