News for hackers. Stuff that matters.
Re:Fresh – Next-gen web framework by LeanderK on Monday June 13, 2022 @03:33AM (#31722380)
if the code is the same on the server, one could serialise the state and transfer it with the html, right?
Re:Fresh – Next-gen web framework by lbriner on Monday June 13, 2022 @06:41AM (#31723529)
The way I read it, you might have lots of javascript to compute and render your e.g. counter control but you can keep that on the server side, only return the (much smaller) piece of HTML code and ONLY the JS needed to make the control interactive.

I don't know whether this means that it doesn't work as SPA any more since if you want to keep the best of both, you will end up creating more4 complexity, a new framework to learn and probably get marginal improvements at best.

Re:Fresh – Next-gen web framework by axlee on Monday June 13, 2022 @05:53AM (#31723169)
That's how it works.
Re:Fresh – Next-gen web framework by redbar0n on Monday June 13, 2022 @08:50AM (#31724797)
that’s how it works, but you also need to attach event handlers and set up the state for the framework on the client-side (for subsequent interactions).
Re:Fresh – Next-gen web framework by LeanderK on Monday June 13, 2022 @11:27AM (#31726933)
I meant the state for the framework, as I understood it the same framework was used on the serverside.
Re:Fresh – Next-gen web framework by ash on Monday June 13, 2022 @03:36AM (#31722396)
You still have transfer the JS.
Re:Fresh – Next-gen web framework by eyelidlessness on Monday June 13, 2022 @11:30AM (#31726978)
Right, but not all of it. The way Qwik serializes it is (this is from memory and probably overly simplistic, but conceptually approximate):

- Primitives already present from the server render are serialized directly into the HTML, and the compiled code reads those values from the DOM

- Everything else is split into fine grain chunks, assigned a special identifier (Qwik uses URLs) which is serialized to the HTML to fetch (which can be eager or on-demand) and activate interactivity as needed

My understanding is that currently Qwik serializes more than necessary—i.e. can be optimized further to eliminate non-interactive chunks from consideration—but that they’re focused on reducing JS cost first.

Re:Fresh – Next-gen web framework by alrlroipsp on Monday June 13, 2022 @03:39AM (#31722411)
ITT, it was finally proven that JS is not code.
Re:Fresh – Next-gen web framework by solardev on Wednesday June 15, 2022 @01:50AM (#31749545)
I don't think anyone believes JS is a great language. It's just what we're stuck with.

How I wish something, anything better could've taken over. .NET was beautiful to work in. Maybe the native apps for iOS or Android are cleaner (I dunno, never tried).

But browsers are what the world use, and they only speak HTML and Javascript (sadly). So we're stuck unless something else manages to create a sea change in how the world uses the internet.