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.
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.
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...
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.
Месяц назад+2
I think the "solution" at 355s (5:55) has the same issue, that count is not tracked.
you can move `count` before `await` otherwise Svelte won't track it
Месяц назад+3
@@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"
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.
@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
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
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.
I was not expecting THIS much depth in this short of a video lol
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.
sounds good to me
the use of unlisten is very common in Tauri apps. I use onMount and onDestroy, hope they don’t get removed
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...
you should avoid effects and `$:` was used for both deriving values and side effects but now you have `$derived` and `$effect`
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.
I think the "solution" at 355s (5:55) has the same issue, that count is not tracked.
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
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"
Don't you need await to fulfill the promise/async ?
First 🎉
Or even better, just avoid svelte
If you don't like Svelte why waste your time watching and commenting on Svelte videos?
if you think front-end frameworks are useless you probably haven't worked on anything complex
Says the react user
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.
@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
Hi everyone,
ruclips.net/video/fR6DFKq13J0/видео.html
what rich is talking about here?
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