News for hackers. Stuff that matters.
Re:Qwik: No hydration, auto lazy-loading, edge-optimized, an... by nextaccountic on Wednesday October 12, 2022 @12:32AM (#33172881)
What do you mean by no hydration? How does the client-side code picks up state from the initial render? (does Qwik apps load faster due to not needing hydration?)

Also, it talks about reactivity. Does it means it has no vdom? Is it related for no need for hydration?

Re:Qwik: No hydration, auto lazy-loading, edge-optimized, an... by simonhorlick on Wednesday October 12, 2022 @02:17AM (#33173508)
Relationships between components and the app state are serialised along with the html. A small (~1kb) library is used to lazy load javascript as the user starts interacting. The key is that it's immediately usable, you don't require a client side re-render before any of the buttons work, for example. This means you can get great PageSpeed scores really easily and the apps feel super responsive.

I have no affiliation with Qwik, but I did try it out on a small project yesterday to see how it works. I'm really impressed so far.

Re:Qwik: No hydration, auto lazy-loading, edge-optimized, an... by kaleidawave on Wednesday October 12, 2022 @09:46AM (#33176899)
It is true that a button's click event can fire before a client re-render. *However* if that event changes state it does have to do a initial VDOM render to make a first frame before a second one to work how to change the actual DOM and the UI. and although that click event does run it needs to be redirected to the actual event handler. That redirect needs to do downloading, parsing and hydration. So "immediately usable" and "super responsive" are a stretch here...
Re:Qwik: No hydration, auto lazy-loading, edge-optimized, an... by meenie on Wednesday October 12, 2022 @02:59PM (#33181451)
There is a service worker that will prefetch all of the event handlers currently in view. So when the person clicks on the button, the browser will fetch the JS, but the service work short circuits that request and returns the JS instantly. They have plans to make the prefetching even smarter by gathering information on which chunks are most used and prefetch those first.
Re:Qwik: No hydration, auto lazy-loading, edge-optimized, an... by kaleidawave on Thursday October 13, 2022 @04:11PM (#33195919)
Ah I didn't realise it did that? The homepage still makes several references to lazily downloading JS?

Eagerly downloading JS is something every framework does though and many only download for the current view through code splitting for the current page. It doesn't fix the later two problems..., struggling to find any benefits above existing techniques here :/

Re:Qwik: No hydration, auto lazy-loading, edge-optimized, an... by mpeg on Wednesday October 12, 2022 @03:34AM (#33173968)
Resumability is still a kind of hydration, I suppose, but it's so much more efficient that it makes sense to separate it from hydration and just say it's "no hydration" same as some frameworks advertise "0kb js" when what they mean is just a kind of progressive enhancement that still includes js.

There is no vdom on Qwik, it is kind of a requirement for fast hydration / resumability to not have a vdom – otherwise there is only so much optimisation you can do when you need to convert all your server-rendered markup into a vdom representation.

Re:Qwik: No hydration, auto lazy-loading, edge-optimized, an... by kaleidawave on Wednesday October 12, 2022 @09:34AM (#33176733)
Re:Qwik: No hydration, auto lazy-loading, edge-optimized, an... by mpeg on Wednesday October 12, 2022 @09:59AM (#33177073)
My bad, you’re right it seems they’re currently using a vdom; I suppose this is something they’re looking to get rid of before 1.0 since I’ve seen they’re implementing signals for reactive updates (like solid does)