Profile avatar
matsimon.dev
Lead Software Engineer @derstandard.at Full Stack Developer (SvelteKit, SwiftUI) https://www.matsimon.dev Founder of https://www.pausly.app ⭐️ Musician https://www.yesmeno.com 🎸 🎤 🎹 🥁 Blender enthusiast 🎨
175 posts 155 followers 208 following
Regular Contributor
Active Commenter
comment in response to post
https://www.matsimon.dev
comment in response to post
@tolin.ski Zero looks really promising to me and I love your Svelte adapter. Where and how do you deploy your zero-cache and what is your goto service for the PostgreSQL database?
comment in response to post
I agree. Still using camelCase thought because that's just how JavaScript is written. Would feel out of place with other libraries and platform functions. (From reading your comments you seem to agree)
comment in response to post
Near the end you write "I’m still not convinced though because could a junior developer understand that more than this?". That is also a purely anecdotal argument, and I disagree with you. I think it's easier to parse and understand that a pseudo class is added to the selector with &:hover.
comment in response to post
Absolutely :) But to be fair, the match with Magnus was *really* close. And it was way really short too. It would be very entertaining to see a format with more games.
comment in response to post
Mastodon ist nicht besonders geeignet für sowas weil man dann die Instanz angeben muss. Generell ist das mMn der Grund warum Mastodon nie abgehoben hat oder abheben wird. Instanzen haben zu viel Einfluss auf das Netzwerk.
comment in response to post
Ach steht eh ganz am Anfang. Danke :)
comment in response to post
Wie war die Fragestellung?
comment in response to post
Funny... I made the exact argument in a Reddit post a few days ago. People constantly complain that there aren't enough svelte jobs, while simultaneously complaining that the team focuses on making Svelte are more reliable framework for big and professional projects. 🤷‍♂️
comment in response to post
How does that break reactivity?
comment in response to post
Same 😂
comment in response to post
Und könnte man kein Gesetz machen, dass das ORF Budget festlegt so dass es nicht einfach so von einer Regierung geändert werden kann? Oder ist das auch nur deswegen nicht realistisch weil es so ein politischer Wirbel wäre?
comment in response to post
Bzw: warum ist die GIS unabhängiger? Kann eine neue Regierung nicht auch einfach die GIS absetzen oder verringern?
comment in response to post
@arminwolf.at ich finde das einen guten und schlüssigen Post. Eine Sache verstehe ich nur nicht so ganz: das Argument warum der ORF nicht aus dem Budget finanziert wird, ist, dass man dann immer mit der aktuellen Regierung verhandeln müsse. Aber könnte das nicht gesetzlich verankert werden? 1/2
comment in response to post
I worded that poorly. It’s not about getting them off the main thread (for which you’d need a web worker) but yielding to the main thread so long running task don’t block the main thread for too long.
comment in response to post
@mandrasch.bsky.social in case you missed it ⬆️
comment in response to post
developer.mozilla.org/en-US/docs/W...
comment in response to post
This means that the actual implementation of the array (and object) proxy is quite simple and handles all possible methods the array implements and might implement in the future. 4/4
comment in response to post
From the docs: "For example, array methods read and write to array through these internal methods, so methods like push() would also invoke get() and set() traps." So all these array methods that modify the array go through these traps that svelte can overwrite in the proxy. 3/
comment in response to post
That would be pretty error prone. Every time JavaScript adds a new method, the Svelte team would need to adapt immediately, otherwise reactivity would break for that specific method. In reality JavaScript proxies are pretty cool. They offer get() and set() traps. 2/
comment in response to post
And I'd like to clarify something. In my bsky thread I said that svelte is smart and proxies the methods and that's why methods like push() work too. The reality is a bit more complicated but more robust too. Svelte doesn't have to proxy ever method that modifies the underlying object. 🧵 1/
comment in response to post
Great post! Thanks for mentioning me. A small note: "When you use an object (including arrays) they are also not states themselves!" This is only correct if you export it (or use it outside the scope it's defined in). In the same scope, if defined with $state(), they can be overridden.
comment in response to post
And finally: for all intents and purposes, SvelteSet has the same signature as Set and should behave the same. I actually believe that there is a bug somewhere why simply logging a SvelteSet didn't work. I guess it used .toString() and this should also use the underlying signal. I'll test this today
comment in response to post
That's also why you don't have to write: let data = $state(new SvelteSet()) The $state() is only necessary if you intend on overwriting the *data* value itself. But that wouldn't work anyway if you export it.
comment in response to post
The reason there is a separate SvelteSet and SvelteMap class (instead of just rewriting it automatically like they do with objects and arrays) is because they wanted to draw a line somewhere since they can't proxy every conceivable object. There are other nice helper objects like SvelteURL for ex
comment in response to post
And svelte is really clever about how to proxy these objects. That's why: myList.push('foo') works too. Because svelte proxied the push method too. (In reality there are mechanisms in JS to handle these pretty nicely). And it's the same story with Set and Map.
comment in response to post
But! all objects in $state get all their values proxied automatically! So effectively this: let myObj = $state({ count: 0 }) gets turned into an object with a getter and a setter for count. So when you import this object, and *then* write: myObj.count = 1 you're using the setter.
comment in response to post
When you use an object (including arrays) they are also not states themselves! That's important to understand. If you do this: import { myObj } from './data' myObj = { count: 20 } you lost reactivity! There is no way for svelte to handle this for you.
comment in response to post
Svelte allows you to use simple values as state by adding the necessary code in the compile step. So when you write myString="new value" it rewrites it so the underlying signal emits a change (same for reading).
comment in response to post
You're encountering the most complicated part of Svelte 5. How reactivity works and how the compiler hides it from you. When you export a single value like a number or string, there is no mechanism for svelte to maintain reactivity because JavaScript doesn't offer a way to track that.
comment in response to post
To be more precise: SvelteSet simply extends the common Set class, and *wraps* a signal. It overrides all read and write functions so that the underlying signal properly emits when changes occur. 🤓
comment in response to post
*with hot reloading
comment in response to post
Yeah I've responded to Matthias already: you can definitely get away with a simple array. It's just that this is what Sets are made and optimized for. And the `.isSubsetOf()` or `.isSupersetOf()` functions can be used in exactly this context to build filters.
comment in response to post
As I said, this only happens when you're doing weird stuff, like debug printing it without actually iterating over the values.
comment in response to post
And yeah sure you can just use an Array (you don't have to put it in an { values: [] } object either). It's just that this is _exactly_ what Set is for, and it provides nice functions like `.isSubsetOf()`.
comment in response to post
Ah yes sorry... It's because .values() returns an iterator and you're not iterating over it. You can just use [...selectedColors]. This actually accesses the values.