Skip to main content

All Questions

Tagged with
0 votes
0 answers
39 views

Returning an array from server-side to client-side in Svelte 5

I am using Svelte5. When I send an array from +page.server.js to +page.svelte it always works server-side and the array is sent as expected. However when +page.svelte is running on the client side ...
k4mars's user avatar
  • 11
1 vote
0 answers
79 views

Svelte 5 memory leak in simple example

I'm encountering many memory leaks when using both Svelte 4 and 5 on reasonably complex projects, and having trouble identifying what I'm doing wrong. Here is an extremely simplified Svelte 5 example (...
chris838's user avatar
  • 5,188
0 votes
2 answers
77 views

Svelte 5 Unsafe State Mutation at Tree Component

I need help with Svelte components. I've built a tree that should allow users to check nodes and update related nodes. When a node is checked, its parents and children should react accordingly. ...
Korte Meyer's user avatar
0 votes
1 answer
64 views

How to get a component's children height?

I'm trying to create a component that will render it's children when it comes into the viewport, here's the code: <script lang="ts"> import type { Snippet } from 'svelte'; ...
Christopher Poulsen's user avatar
0 votes
1 answer
53 views

How to dispatch multiple events from a component?

Let's imagine we have simple <input> with onChange and onPaste event. In Svelte4 I have used to use this code: import {createEventDispatcher} from "svelte"; const dispatch = ...
Manny's user avatar
  • 566
1 vote
0 answers
49 views

svelte 5 not updating during outro

I am in the middle of a migration from svelte 4 to svelte 5 and I've run into an issue. Previously when there was an update to a variable the component updated in response to it, even if the component ...
munHunger's user avatar
  • 3,061
1 vote
2 answers
505 views

Other than children(), can I import and render multiple snippets in +layout.svelte that are defined in +page.svelte?

New to SvelteKit and trying to figure this part out... Here's a couple of ways I was trying to achieve this, but the sidebar either doesn't load, or the navigation appears twice for some reason; with ...
Brad T's user avatar
  • 35
0 votes
1 answer
58 views

How to fix non-reactive nested objects inside a $state([]) in Svelte?

Here's the link to repro (Svelte Playground). The problem is that when you add a "waypoint" and toggle the checkbox to enable its bearings (thus changing the respective nested object's ...
smellyshovel's user avatar
0 votes
1 answer
64 views

Effects no longer work with reactive objects when using runes

In Svelte 4, the effect below would fire every time user or pass props from it changed let data = { user, pass, }; $: data && clearErrors() In Svelte 5 the equivalent code with runes ...
Alex's user avatar
  • 66.3k
1 vote
1 answer
294 views

$state object could not be cloned

After I switched to Svelte 5 syntax I am getting this error when I pass a reactive variable to a function let details = $state({ user: '', pass: '' }) // ... await login(details) // <- error ...
Alex's user avatar
  • 66.3k
2 votes
1 answer
181 views

Svelte 5: Form briefly appears then disappears on page load when using conditional rendering for an image

I'm encountering a strange issue with a Svelte 5 component where a form briefly flashes on the screen for about half a second when the page loads, and then disappears. This happens when I have ...
Leonardo Cavalcante's user avatar
0 votes
1 answer
116 views

Loading data server side and allow global access client side

I'm having a hard time understanding the use of Runes and data loading. I load a supabase json file and I want to access the data globally. // +page.server.js export async function load() { const [...
16ar's user avatar
  • 175
0 votes
1 answer
71 views

Svelte:window component onload not triggering

In Svelte5, why is the onload event not triggering the function foo() in src/routers/+layout.svelte? <script> const foo = () => console.log('foo triggered') </script> <svelte:...
aknott's user avatar
  • 219
0 votes
1 answer
63 views

How to pass value to rendered children?

I have an await block in my +layout.svelte for a product fetch function in the load function. When the promise is fullfilled it renders a +page.svelte as a children and I need to pass the product to ...
Filippo's user avatar
  • 151
0 votes
1 answer
149 views

Embedding Svelte 5 inside PHP (Imperative component API)

I'm trying to use Svelte 5 and SvelteKit inside PHP. I don't understand how to use the Imperative component API (https://svelte.dev/docs/svelte/imperative-component-api). Where do I put the following ...
bboolean's user avatar

15 30 50 per page