Eyal
banner
eazulay.bsky.social
Eyal
@eazulay.bsky.social
Focus > Flow > Build
💻Developer with 35+ years of code in my veins. ✨Geeking over Svelte & SvelteKit, Divi on WordPress, and Salesforce Admin/Dev. Passionate about A11y, Sustainability in software, remote working and coffee.
Tip 3: Component $bindable(myFunction) props are unusable because the parent cannot bind to them (a var that starts undefined). Runtime error: "Cannot do bind:value={undefined} when `func` has a fallback value."
Solution: Remove fallback and assign to it later; add undefined| to the property type.
December 29, 2024 at 10:24 PM
Tip 2: The Migration script adds this interface to each .svelte file:
interface Props {
data: any;
form: any;
}
To get error checking and auto-complete help, change it to:
import type { PageData, ActionData } from "./$types";
interface Props {
data: PageData;
form: ActionData;
}
December 29, 2024 at 9:40 PM
Tip 1: For logic that has to run once after every data load, in Svelte 4 I called a function from a $: statement. Cannot do this in 5: $effect doesn't run in SSR; Outer scope warns "State referenced in its own scope..."; $derived only works for read-only data.
My solution: put such logic in +page.ts
December 29, 2024 at 9:31 PM
My project has 34 .svelte files. 13 in components, 21 under routes.
Yes, around 40 hours.
I'll reply on my post about the learnings...
December 29, 2024 at 8:35 PM
Yes, I did. I still had to edit almost every .svelte file. It often got the line order wrong, destructuring data before it’s declared.
December 28, 2024 at 2:54 PM