Thanks so much! I've been working on an application that uses Svelte 5 and accesses a database, and finding any information on how to handle things asynchronously has been a nightmare.
@DeviantFoxАй бұрын
I was not expecting THIS much depth in this short of a video lol
@huakunАй бұрын
what if the returned cleanup function depends on the async function? e.g. the async function returns an unlistener. The solution I can think of is to store the unlistener outside as a mutable variable with let, then call it in the clean up function.
@JoyofCodeDevАй бұрын
sounds good to me
@huakunАй бұрын
the use of unlisten is very common in Tauri apps. I use onMount and onDestroy, hope they don’t get removed
@davidpierrumentorАй бұрын
Hi, I love your video and I the feeling you put in it. May I suggest a video on testing a simple application with svete and vitest ? (without and with sveltekit ?). I didn't found any great video with svelte 5.
@honk_tmАй бұрын
So we are back to writing vars without any other purpose than forcing a refresh on an effect, just as we had with $: before. I thought Svelte 5 was made to fix that horrendous thing...
@JoyofCodeDevАй бұрын
you should avoid effects and `$:` was used for both deriving values and side effects but now you have `$derived` and `$effect`
Ай бұрын
I think the "solution" at 355s (5:55) has the same issue, that count is not tracked.
@dumboluzzАй бұрын
I was thinking the same. Gotta try this out once I get home
Ай бұрын
@dumboluzz I did already 😉
Ай бұрын
btw I think the solution is to pass count into the async function as parameter
@JoyofCodeDevАй бұрын
you can move `count` before `await` otherwise Svelte won't track it
Ай бұрын
@@JoyofCodeDev sure, but in real cases probably you want to use the value inside the async function. so passing as parameter can be seen as "moving above async"
@mylastoreАй бұрын
Don't you need await to fulfill the promise/async ?
@j.m.manhardАй бұрын
First 🎉
@StephanHoyerАй бұрын
Or even better, just avoid svelte
@realderekАй бұрын
If you don't like Svelte why waste your time watching and commenting on Svelte videos?
@arampАй бұрын
if you think front-end frameworks are useless you probably haven't worked on anything complex
@oskarkottom8365Ай бұрын
Says the react user
@StephanHoyerАй бұрын
Yes I don't like because it's such a dumb idea and I don't understand why anyone thinks it is a good one. Sure, for anything simple it might be worth it. But for complex apps the framework part is only a fraction of the resulting code so why not using a real framework in the first place. And one which actually works like javascript not some complex custom language that relies on magic left and right and that isn't debuggable at all. And no I don't hate frameworks. I use a really great one called mithril that is simple yet powerful and small. And I also build a pretty complex app with it the is comparable to Google docs or canva. And it works like a charm for years now.
@StephanHoyerАй бұрын
@realderek I generally also watch videos about other frameworks to learn something that I can use in my framework of choice. May there are some good ideas there too
@RohitKumarAnkamАй бұрын
Hi everyone, kzbin.info/www/bejne/nIOZdXmBppZmgJI what rich is talking about here?
@JoyofCodeDevАй бұрын
I think Rich is talking about suspense and fetching data at the component level like RSC, which Svelte right now doesn't support, but they're thinking about it