You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It doesn't seem like there's a way to use the svelte runes within the +page.ts, +layout.ts, +page.server.ts and +layout.server.ts, and it doesn't seem like there's any documentation. This seem like a major limiting factor in implementing reactivity using the new methods. Attempting to do so gives the following error:
Svelte error: rune_outside_svelte The '$state' rune is only available inside '.svelte' and '.svelte.js/ts' files
Attempting to rename the load files to something like +page.svelte.ts gives the following error:
Files prefixed with + are reserved (saw /+page.svelte.ts)
Reproduction
importtype{PageLoad}from'./$types';exportconstload: PageLoad=()=>{letx=$state(None)return{
x
};};
You can already use svelte/reactivity classes there. Arrays, primitives and objects cannot be used as of now but Map, Set and Date can be.
I use this to handle live data updates via SSE and reactivity works as expected. Note that I use adapter-static without prerendering nor SSR enabled.
Describe the bug
It doesn't seem like there's a way to use the svelte runes within the +page.ts, +layout.ts, +page.server.ts and +layout.server.ts, and it doesn't seem like there's any documentation. This seem like a major limiting factor in implementing reactivity using the new methods. Attempting to do so gives the following error:
Svelte error: rune_outside_svelte The '$state' rune is only available inside '.svelte' and '.svelte.js/ts' files
Attempting to rename the load files to something like +page.svelte.ts gives the following error:
Files prefixed with + are reserved (saw /+page.svelte.ts)
Reproduction
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: