Live data from Hacker News

Svelte: $derived can now be overwritten

github.com

11–20 of 55 posts

Re: Svelte: $derived can now be overwritten

#11
post #9
post #4

People who have migrated a large enough production codebase to Svelte 5, what's your devex like?

I'm almost finished with a large, complex app written with Svelte 5, web sockets and Threlte (Three JS) [0]. Previously, I'd written React for about a decade, mostly on the UI side of things. I vastly prefer Svelte, because of how clean the code feels. There's only one component per file, and the syntax looks and writes deceptively like vanilla JS and HTML. There's a bit of mind-warp when you realize Svelte doesn't w…

"There's only one component per file"

If you don't do this in React, its your own fault.

Re: Svelte: $derived can now be overwritten

#13
post #9

Earlier quoted context omitted.

I'm almost finished with a large, complex app written with Svelte 5, web sockets and Threlte (Three JS) [0]. Previously, I'd written React for about a decade, mostly on the UI side of things. I vastly prefer Svelte, because of how clean the code feels. There's only one component per file, and the syntax looks and writes deceptively like vanilla JS and HTML. There's a bit of mind-warp when you realize Svelte doesn't w…

"There's only one component per file" If you don't do this in React, its your own fault.

I also don't really see why this is a positive. If you have too much in a file, then split it off? It doesn't fundamentally add or subtract and complexity either way.

Re: Svelte: $derived can now be overwritten

#14

Agh, I understand why runes were implemented, but I still can't get myself to like them. It feels like Runes take away from what made Svelte Svelte (the simple, concise syntax), and changes like this seem like slow concessions back in that direction anyway.

You just have to build a big project with Svelte 5 and you will come to like them.

A lot of magic is okay for simple application, but when you want to build anything that scales Svelte before runes was just horrible. With Svelte 5 and Runes you can look at any component and instantly know what it does. You couldn't do that with Svelte 4 unless you wrote the whole code yourself.

Re: Svelte: $derived can now be overwritten

#15
post #4

People who have migrated a large enough production codebase to Svelte 5, what's your devex like?

I'm not a developer by trade, and have gone from 0 full-stack knowledge to building a MVP for my startup in 18 months using Svelte 4 and SvelteKit. Looking at the JS/TS ecosystem from the outside, it was a total nightmare and Svelte 4 was the only framework that seemed to make logical and aesthetic sense to me.

Currently porting to Svelte 5 and it is less elegant in my opinion, but perhaps the problems it tries to solve are for more sophisticated developers and I don't really come across them or have knowledge of them. I would prefer to stay on 4, but I will take Rich's word for it that it will be better long term.

Admittedly complicated components with lots of reactivity can be confusing to follow data changes with lots of $: lines so I have tried to minimise that from the beginning. The Svelte 5 code looks cleaner to follow for onboarding devs that aren't familiar with our codebase yet.

Re: Svelte: $derived can now be overwritten

#16

Agh, I understand why runes were implemented, but I still can't get myself to like them. It feels like Runes take away from what made Svelte Svelte (the simple, concise syntax), and changes like this seem like slow concessions back in that direction anyway.

They really are an improvement. Tracking data flow in a complicated component (bound props going in both directions, derived state, …) was terrible before runes — you just had to rely on compiler magic, which worked until it didn’t. Now it’s more or less obvious.

Re: Svelte: $derived can now be overwritten

#17

Agh, I understand why runes were implemented, but I still can't get myself to like them. It feels like Runes take away from what made Svelte Svelte (the simple, concise syntax), and changes like this seem like slow concessions back in that direction anyway.

I felt the same way at first, but even in my small project, I've come to greatly appreciate them—or at least what they seem to enable. I've found deeply nested bindings to work without a hitch, which wasn't always the case in Svelte 4.

Re: Svelte: $derived can now be overwritten

#18
post #4

People who have migrated a large enough production codebase to Svelte 5, what's your devex like?

As much as I appreciate Svelte, the React devex is unmatched. I built a client-side app using Wails with Svelte 5 and I found myself wanting React's seamless devex and vast ecosystem. Once I migrated over to React it was like a huge handicap was lifted.

Svelte is great. But if you're in a time crunch and you don't have a specific technical requirement that makes React a bad match, I don't think Svelte is worth it. A big part of the Svelte ecosystem is still using Svelte stores, and I found the "one component per file" paradigm to be a bit limiting.

Re: Svelte: $derived can now be overwritten

#19
post #18
post #4

People who have migrated a large enough production codebase to Svelte 5, what's your devex like?

As much as I appreciate Svelte, the React devex is unmatched. I built a client-side app using Wails with Svelte 5 and I found myself wanting React's seamless devex and vast ecosystem. Once I migrated over to React it was like a huge handicap was lifted. Svelte is great. But if you're in a time crunch and you don't have a specific technical requirement that makes React a bad match, I don't think Svelte is worth it. A…

> A big part of the Svelte ecosystem is still using Svelte stores

Just a nitpick, with runes in Svelte 5, stores have largely become obsolete. $state, $derived, and $effect replace most of the needs people would normally use stores for.

Re: Svelte: $derived can now be overwritten

#20
post #3

As someone who has not used Svelte 5: What is the significance of his change?

https://github.com/sveltejs/cli/issues/487#issuecomment-2743...

And for catching up on what a 'rune' is.. that's the `$derived` and `$effect` there, basically $-prefixed built-in things? Has that entirely replaced `$:` or is it as well as? Svelte seems to have got more complicated since I last used it!
Post reply on HN