News for hackers. Stuff that matters.
Re:Fresh – Next-gen web framework by solardev on Sunday June 12, 2022 @10:40PM (#31720422)
Ooh, some competition for Next.js?

Vercel is doing a really good job with Next, but it's good to see some competition. Of course, that means there's now 65,535 + 1 more way of serving a web page using Javascript (sigh).

Rehydration is a really big deal. Sounds dorky but it dramatically speeds up load times and such by serving flat HTML and injecting JS afterward, like the old days, except you can write code like it's not the old days.

Re:Fresh – Next-gen web framework by eyelidlessness on Monday June 13, 2022 @02:14AM (#31721833)
> Rehydration is a really big deal. Sounds dorky but it dramatically speeds up load times and such by serving flat HTML and injecting JS afterward, like the old days, except you can write code like it's not the old days.

Hydration is actually a compromise, and not a great one for UX. It’s in fact been said to be “pure overhead”, which I think is an overstatement but only slightly.

What you’re describing in the abstract is spot on though. Serializing server state to HTML and sprinkling in interactivity to pick up where it left off is exactly where we should be headed.

And yes it is like the old days, and yes all of HN will rapidly say so. The big difference now is the convergence of code written for both server and client, and compilers which help strip down and optimize what happens in the client.

Hydration in the current sense is re-running most of what the server already did, to recreate the runtime state it already had. That may be perceptively faster in terms of metrics like first paint, but it’s a huge barrier for time to interactive. All the more so when most content is static and has to load twice—fast first as HTML, then slower and redundantly as JS.

The best way to solve this is to not serve or hydrate anything at all unless you need to. The “islands” approach is a very good, but coarse, way to solve this: isolate components which are actually interactive, treat the rest as static. A more granular approach—termed resumability by Qwik and as I understand it the forthcoming version of Marko—works by treating the server-generated HTML as the initial state. The code executed from there is much more isolated than a full component.

Re:Fresh – Next-gen web framework by DylanSp on Monday June 13, 2022 @08:17AM (#31724396)
> A more granular approach—termed resumability by Qwik and as I understand it the forthcoming version of Marko—works by treating the server-generated HTML as the initial state. The code executed from there is much more isolated than a full component.

Is that sort of what Phoenix LiveView does? Return a fully server-rendered page on initial load, then set up a "template" on the client side that can receive any values that change server-side over a websocket and patch them into the DOM?

Re:Fresh – Next-gen web framework by eyelidlessness on Monday June 13, 2022 @11:19AM (#31726803)
This sounds conceptually similar, albeit maybe more similar to React Server Components? I’m really not familiar enough with Phoenix to get that specific though. Even in the JS ecosystem there’s a lot of nuance between seemingly similar approaches (hence why even commonly referenced concepts like hydration can be confused for what they actually do).
Re:Fresh – Next-gen web framework by DylanSp on Monday June 13, 2022 @11:41AM (#31727104)
I think what Fresh is doing now is more similar to Server Components, shipping full components to the client. With LiveView, once it's set up on the client, the updates it sends over the wire are much smaller. https://fly.io/blog/how-we-got-to-liveview/ shows some examples of the idea.
Re:Fresh – Next-gen web framework by eyelidlessness on Monday June 13, 2022 @12:06PM (#31727415)
Yeah this looks much more similar to Qwik. It even looks like they have a similar view serialization approach.
Re:Fresh – Next-gen web framework by mayank on Monday June 13, 2022 @04:16AM (#31722663)
> The big difference now is the convergence of code written for both server and client, and compilers which help strip down and optimize what happens in the client.

I understand the spirit of your comment, but this was/is also true of Google Web Toolkit (GWT).

Re:Fresh – Next-gen web framework by eyelidlessness on Monday June 13, 2022 @11:13AM (#31726712)
I’m going to have to take that on faith, their site doesn’t appear to ship the JS necessary to open the nav menu. But clicking through a few links confirmed what I recall: the major difference (apart from language) is the component/templating approach. Not that one is inherently better than the other (though I do personally prefer JSX), but bringing this concept to a dev environment which thus far mostly lacks it is a good thing for users. And with more flexibility in variety, there’s better odds users will get that experience.
Re:Fresh – Next-gen web framework by redbar0n on Monday June 13, 2022 @08:47AM (#31724747)
> Hydration in the current sense is re-running most of what the server already did, to recreate the runtime state it already had.

It’s interesting that the problems with hydration is in some sense caused by the insistence on one-way data binding (deriving the view from the state). I imagine that with two-way data binding then you’d just need to attach event handlers and then the state would be derived from the view on the next interaction. Maybe.

Re:Fresh – Next-gen web framework by nine_k on Monday June 13, 2022 @10:13AM (#31725865)
It's really easy to make the states diverge this way. That's why the one-way binding is popular.

OTOH if there were a way to produce a two-way implementation from a one-way description, that could be great for performance. But this is already more CS than engineering.

Re:Fresh – Next-gen web framework by redbar0n on Monday June 13, 2022 @11:10AM (#31726676)
How do the states diverge?

I think you can have a two-way binding with a controlled update procedure, akin to one-way data-binding. I’ve read some people claim to do it by producing a kind of one-way directionality under-the-hood (?) from two-way bindings. The goal being that views can update state (and other views).

I think it was here I read it:

«‘2-way’ shouldn't be a problem if a component reports user events (perhaps transformed/mapped) to the domain model without changing it's own core state (disregarding throttling etc.) and only changes its core state in response to events from the domain model.« — peerreynders @ https://dev.to/peerreynders/comment/1objn

Re:Fresh – Next-gen web framework by eyelidlessness on Monday June 13, 2022 @11:05AM (#31726618)
I’m not sure that gets you much. You still have to know which parts of the code are implicated in executing those event handlers, which very likely close over other state and call into other logic. To an extent you can get that with static analysis (as Qwik does, with one-way binding), but highly dynamic code is tricky no matter what.
Re:Fresh – Next-gen web framework by melony on Monday June 13, 2022 @04:22PM (#31731269)
For all the improvements pioneered by Marko, why is eBay still so slow (compared to equivalent ecommerce sites in Next.js and similar)?
Re:Fresh – Next-gen web framework by pier25 on Monday June 13, 2022 @10:45PM (#31734194)
My guess, the bottleneck is in the data layer.

Honestly it's unfair to compare a small e-commerce site made with Next to one of the biggest websites on the internet.

If Ebay was made with Next it would probably be much slower. React is the slowest at SSR of the modern frameworks. Amazon considered using it but it was too slow for them so they keep using Java + sprinkled JS.

Re:Fresh – Next-gen web framework by melony on Thursday June 16, 2022 @09:35AM (#31765870)
What's the story behind Amazon's SSR?
Re:Fresh – Next-gen web framework by pier25 on Thursday June 16, 2022 @01:52PM (#31768958)
Re:Fresh – Next-gen web framework by eyelidlessness on Wednesday June 15, 2022 @02:54AM (#31749917)
I’m not sure why you’re asking me, but I just did a quick “how slow does eBay feel” on my really spotty mobile connection and it didn’t feel slow at all. Faster than HN, which is usually my fast baseline that responds even when I’m not coaxing my network settings.
Re:Fresh – Next-gen web framework by pier25 on Monday June 13, 2022 @10:41PM (#31734180)
> Serializing server state to HTML and sprinkling in interactivity to pick up where it left off is exactly where we should be headed.

Ironically we were already doing that 15 years ago years with PHP/ASP/Java/Rails + jQuery.

Re:Fresh – Next-gen web framework by eyelidlessness on Monday June 13, 2022 @10:47PM (#31734205)
This is neither ironic nor correct. But I will say I’ve described my mental model of Qwik as effectively that UX, but the compiler writes the jQuery for you.
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.

Re:Fresh – Next-gen web framework by sdevonoes on Monday June 13, 2022 @05:10AM (#31722948)
> except you can write code like it's not the old days.

I imagine you mean that writing (frontend) code now a days is better than how it was in the old days. Well, at least from my perspective that's not the case. "Modern" frontend code requires:

- a package manager (npm)

- node (or deno or whatever)

- transpilers (or is it plugins?)

- TS

- 10K+ dependencies

And to be honest, what is all that good for? To being able to "hydrate" some server-side rendered template? Not good enough reason.

Re:Fresh – Next-gen web framework by madeofpalk on Monday June 13, 2022 @05:34AM (#31723067)
If you think it's bad then why do you use it? Browsers still support just HTML. You can shove a just a script tag down in the page.

Eventually, you'll have enough devs working on this you'll start to run into issues with how you coordinate your work. Your site becomes large enough the code gets more complicated and needs organising to work on it without slowing you down. You'll start to reinvent the above tools to solve these problems.

Frontend/JS tooling isn't perfect, but don't pretend like other languages/systems (can) have a complex pipeline of build tooling.

Re:Fresh – Next-gen web framework by jhgb on Monday June 13, 2022 @06:41AM (#31723535)
> If you think it's bad then why do you use it?

I didn't see GP make the claim of using it?

Re:Fresh – Next-gen web framework by mattkenefick on Tuesday June 14, 2022 @08:24AM (#31738178)
Taking it a little personal, eh?
Re:Fresh – Next-gen web framework by kennywinker on Monday June 13, 2022 @12:29PM (#31727777)
I recently wrote a small web app.

I started with https://alpinejs.dev/ linked via CDN, and OpenJSCAD, also linked via CDN - I wrote basic html, marked it up with alpine `x-model` and `x-data` tags, and sprinkled a little vanilla js on top. Everything worked well and I got 80% of the way through the project.

In the final 20% I ended up adding a bundler (parcel), so I could bring in an scss framework and override its variables. While it added a fair bit of complexity to the project (dev dependencies, parcel config files) I gained lighter files via parcel's tree-shaking and minification, auto-recompilation/reload during development, and re-usable html partials via `posthtml-include`. I'm also set up to swap to typescript quickly, if the project gets more complex and I start to get annoyed with the lack of compile-time type checking.

So, it's 2022, and you can write a web app without any of the things you mentioned (transpilers, package managers, typescript). Yes, adding even one of them nets you a 100+ dependency node_modules directory - but the reason we keep adding them to our projects is the things it gives us are NICE, and the cost (complexity) is mostly worth it.

Re:Fresh – Next-gen web framework by hunterb123 on Monday June 13, 2022 @06:07PM (#31732386)
You made a web site that displays a document. Not a web app. Web apps, like native apps, have a lot more UI state that needs certain patterns and tech to manage them properly. Many devs can discern the difference and use the correct tools. Some do reach for the wrong tool but it's not the tools fault.
Re:Fresh – Next-gen web framework by kennywinker on Tuesday June 14, 2022 @02:14AM (#31735326)
I actually am aware of the difference between a web app and a document, and I used the correct word. Thanks
Re:Fresh – Next-gen web framework by 5e92cb50239222b on Monday June 13, 2022 @05:24AM (#31723014)
We've been able to replace a couple of client applications that previously used WPF with a React frontend (and a small native application that uses WebSockets to create a bridge between the browser and a particular piece of local hardware).

Updates are now easy-breezy (update the server and you don't have to touch clients at all).

There is a place for SPAs. I just don't think your typical grocery store website should use something like that.

Re:Fresh – Next-gen web framework by solardev on Monday June 13, 2022 @12:24PM (#31727690)
What SHOULD grocery store websites use, then? I feel like they're some of the most complex websites around (if they do any ecommerce/online pickups at all)... between product reviews, indexing, filtering, sorting, checkouts, SMS/push notifications, geolocation, real-time inventory, etc. It's not the sort of site that says "easily built in plain HTML" to me.
Re:Fresh – Next-gen web framework by ratww on Monday June 13, 2022 @09:50AM (#31725556)
> "Modern" frontend code requires:

Not necessarily, at least in the case of React and Vue.

Rather than using NPM, you can self-host react/vue (or preact if you need something even smaller), or serve it from Unpkg.

You don't need node/transpiler/bundlers if you're only targeting modern browsers. You can use modern syntax, async/await, ES6 import and a bunch of other features with static .js files.

JSX is a tough one, but there are solutions to that, packages domz and HTM are made to allow using React/Preact without NPM/transpilers.

Typescript is also a tough one. But it's also optional, although a good idea to have. I hope optional type annotations land in ES6 soon so typechecking can happen without anything resembling compiler phase.

-

> To being able to "hydrate" some server-side rendered template? Not good enough reason.

The "hydrating" parts is entirely optional in "modern frontend". It also needs some stuff on the server that is IMO significantly more complex than what I described above. But apart from some very specific cases, one don't necessarily need it.

Re:Fresh – Next-gen web framework by solardev on Monday June 13, 2022 @12:11PM (#31727497)
Believe me, I hate the toolchain/buildchain as much as anyone. Especially TypeScript (see below). Luckily, Next.js also takes care of all that too! Out of the box it preconfigures all of it with sane defaults. `npm start` and you have a working server with transpilers all seamlessly configured, and when you change a line of code it just hot refreshes in the browser. On a `git push` to Vercel or a similar capably platform, the server transparently does all that and gives you a sandboxed preview environment for that specific build. It is magical.

But really, what I meant about "writing code not like the old days" isn't so much about the shitty toolchain (which Next helps with, but I agree it's shitty). Rather, it's the ability to write code like:

<Header loggedIn={isLoggedIn}/>

<Sidebar options={isLoggedIn ? navOptions.loggedIn : navOptions.loggedOut}

<Dashboard>

{widgets ? widgets.map(widget => <WidgetContainer>{widget}</WidgetContainer) : <Spinner/>}

</Dashboard>

Basically, the ability to compose pages & apps out of components (which different developers can work on), and the ability to manage state in a central controller via Redux or useContext to avoid race conditions and the such. That sort of stuff is REALLY hard to do with plain HTML and JS, especially where there are multiple developers involved. React isn't a magical cure-all, it just makes it easy to componentize large apps into smaller areas of concern.

The shitty buildchain isn't a feature, it's an unfortunate side effect of browsers being limited to JS. Essentially it's a "compile" step that became necessary as the vanilla-JS developer experience wasn't able to keep pace with the complexity of desired business apps (and as devs of various skill levels flooded the market). So the developer tools kept growing, but they still had to be compiled/built into JS for the browsers. Next.js makes it relatively painless, compared to how it was just 3-4 years ago. But I agree, I hate that this is a step at all.

Ugh, as for TypeScript... I get that it's a necessary evil, but I spend more time fighting it than actual bugs... coming from PHP, it was already common practice to manually typecheck and coerce everything when needed, anyway. TypeScript often felt redundant and overly sensitive, especially when it came to async nullables, causing false alarms that React could just've silently handled with {isLoaded ? <Component/> : <Spinner/>}

But TypeScript is optional anyway. It's a superset/addon on top of JS, so you never have to use it if you don't want to. If it's scaffolded for you in someone else's project, usually it's just a matter of a either using a .JS extension instead of .TS, or adding a ts-nocheck or similar to that file. Other devs may hate you for that though, when your object or props ends up breaking theirs... so it's definitely a conversation worth having first :)

Re:Fresh – Next-gen web framework by jasfi on Monday June 13, 2022 @01:40AM (#31721614)
The htmx library is a good way to do that: https://htmx.org
Re:Fresh – Next-gen web framework by c03 on Monday June 13, 2022 @03:28AM (#31722356)
HTMX is revolutionary in it's bang-for-buck simplicity
Re:Fresh – Next-gen web framework by 1337shadow on Monday June 13, 2022 @06:38AM (#31723499)
Unpoly.js also good
Re:Fresh – Next-gen web framework by chrisweekly on Monday June 13, 2022 @06:49AM (#31723589)
https://Remix.run is the real competition for (/successor to) Next.js. It can target a Deno runtime so I guess it's competition for "Fresh", too.
Re:Fresh – Next-gen web framework by dmix on Monday June 13, 2022 @08:56AM (#31724875)
That’s one of the best designed sales pitches I’ve seen for a web framework, you could use this approach to sell any idea.

Just scrolling list of small blocks of text with small/interactive screencasts/animations that communicate the idea via succinct bullet points.

Much more fluid than the usual approach of paragraphs or breaking the page up into large blocks/sections.

It’s closer to older HTML where you just have text and a scrollbar.

Re:Fresh – Next-gen web framework by solardev on Monday June 13, 2022 @12:29PM (#31727783)
Opinion only: I found their front page difficult to skim. It took me several scrolls-to-end-and-back to even realize they were trying to explain concepts on that page, not just showing screenshots. Normally I just page-down quickly to get to the features list or comparison table, but doing so here bypasses most of the explanatory animations. I kept wondering, "where's the section that tells you what this does and how it compares to other frameworks". Then I kept looking for a Features page on their top or bottom nav, but didn't find one.

Maybe it's just years of bad habits trained by seeing too many bad marketing sites, where the typical signal to noise ratio is really bad. I guess even when I see a good sales pitch, I don't recognize it as such anymore and try to skip through it... sigh. Sorry, Remix.

Re:Fresh – Next-gen web framework by dmix on Sunday June 19, 2022 @11:52PM (#31806104)
I viewed it on mobile which I found much nicer than desktop FWIW
Re:Fresh – Next-gen web framework by jjdeveloper on Monday June 13, 2022 @09:56AM (#31725637)
I think Astro is more likely the successor to Next.js and probably not remix. I think Next will steal the best parts of Remix but Astro was built with simpler foundations and has integrations for deno with Netlify edge functions among others and unlike Remix is not tied to React but you can choose your framework.
Re:Fresh – Next-gen web framework by roci89 on Monday June 13, 2022 @11:31AM (#31726997)
Remix is working on a Vue and Preact adapter, so won't be tied to React for long. I see the community is looking at a SolidJS adapter too. I'd say it'll be just fine
Re:Fresh – Next-gen web framework by brundolf on Monday June 13, 2022 @01:12PM (#31728440)
I didn't know Remix supported Deno, that's interesting
Re:Fresh – Next-gen web framework by steve_adams_86 on Sunday June 12, 2022 @11:14PM (#31720654)
Have you seen Remix yet? It’s pretty compelling in terms of competition for Next.JS.

It makes different trade offs and isn’t strictly better by every metric, but overall I’m very happy with it for the two use cases I’ve tried it with. It’s a very low overhead framework once the simple conventions click.

I’d still like to check this out, then redwood and a couple others too. I’m not huge on these frameworks in general, but they tend to have some excellent ideas and smart people behind them, so plenty to learn by experimenting with them.

Re:Fresh – Next-gen web framework by solardev on Sunday June 12, 2022 @11:44PM (#31720832)
I've heard really good things about Remix, especially the nested routes. But I think Next is trying to copy that in Layouts? https://nextjs.org/blog/layouts-rfc

I use Next not just for the routing and composition and hydration, but for all the other quality-of-life improvements (image resizing, buildchain configs, hot reload), especially when it's paired with Vercel (per-push sandbox builds, stale-while-revalidate, seamless CDN, access to serverless, etc.)

I'm really excited to see how Remix and other Next competitors evolve, but for now, I think it's still the most "full" stack of the React frameworks? Is that correct?

Re:Fresh – Next-gen web framework by steve_adams_86 on Monday June 13, 2022 @10:38AM (#31726271)
That’s correct about Layouts, and I agree, if you want something with all the quality of life tooling ready to go, Next seems to be the way to go.

It isn’t too hard to get the same/similar tooling outside of the vercel ecosystem, but it does take know how and a bit of extra time. It isn’t obviously worth it unless vercel isn’t meeting your needs in my opinion/experience.

I mostly play around with other frameworks in order to learn, but for any client where a frontend framework made sense I’d almost certainly choose Next.

Edit: people also get bent out of shape about perfect hydration and shaving milliseconds here and there, but like you mention, Next offers such a comprehensive solution in a situation where routing and hydration are only a part of the big picture. Next gets you really far without any effort up front, which is crazy. I really like it!

Re:Fresh – Next-gen web framework by likortera on Monday June 13, 2022 @03:28PM (#31730483)
It's funny to me to see how many people say Next is copying something about remix when the entire remix thing is a copy of Next.

Heck, I've heard in a podcadt they're even working on a hosting platform copying vercel.

Re:Fresh – Next-gen web framework by steve_adams_86 on Monday June 13, 2022 @10:08PM (#31734030)
For sure, Vercel was working on nested routes before Remix was a thing, as far as I know. A lot of people suggested it was lifted from Remix. It’s not a new idea at all and people have been asking for it for years.

Arguably there is nothing all that novel in either framework. We are constantly reiterating and rebuilding wheels, doing it a little better each time.

I’m glad to see the Remix take in things gaining steam though. It’s quite a bit less cognitive overhead than Next without any magical trade offs. Nothing ground breaking, but definitely better at things I care about.

Like most things, a blend of solutions would be ideal

Re:Fresh – Next-gen web framework by solardev on Tuesday June 14, 2022 @04:13PM (#31745421)
Eventually React is just going to become Angular3, lol
Re:Fresh – Next-gen web framework by solardev on Tuesday June 14, 2022 @04:11PM (#31745395)
All of tech is just people borrowing from each other. It's a good thing! I wish IP patents weren't a thing.
Re:Fresh – Next-gen web framework by ttty on Monday June 13, 2022 @12:31AM (#31721142)
Image resizing can’t be done statically. That’s a big issue if you want to serve things from cdn property.
Re:Fresh – Next-gen web framework by jonny_eh on Monday June 13, 2022 @01:16AM (#31721473)
> that means there's now 65,535 + 1 more way of serving a web page using Javascript (sigh).

You only need one (or none). I personally recommend Next.js for just about anything.

Re:Fresh – Next-gen web framework by onion2k on Monday June 13, 2022 @01:33AM (#31721575)
Next is lovely to work with but it has a flaw. It loses client state between pages if you use getServerSideProps. For any app that needs to load some up to date data on every page if the user is hitting it for the first time, but doesn't need to load it if the client already has it, Next doesn't have a solution. You end up using a persist gateway pattern which is a massive amount of work that you shouldn't really need the client to do.

The problem is that that's pretty much every web app. Every time I've used Next I've end up abandoning SSR and building a plain clientside rendered app.

Re:Fresh – Next-gen web framework by cercatrova on Monday June 13, 2022 @04:43AM (#31722807)
Also, next/image only works with a CDN, ie Vercel, it doesn't work with static site generation. It's been an open issue for years and I honestly now feel like Vercel doesn't fix the problem on purpose, to push more people to using their service rather than simply exporting to a static host which are plentiful.
Re:Fresh – Next-gen web framework by deckard1 on Monday June 13, 2022 @01:07PM (#31728357)
been saying it for awhile... Next.js is an ad for their services.

Take a look at their middleware. It's designed to be used solely with their serverless cloud BS. It uses a janky JS sandbox which means you can't use node APIs. It's just horrible for no good reason at all. I've never seen middleware so intentionally crippled anywhere before.

And the whole reason you need middleware is to maneuver around the flaws that the prior person mentioned with getServerSideProps.

Next.js probably seems great if you're writing greenfield code in a dead simple web app. Routing/URL handling on Next.js is just broken. This is all glaringly obvious if you've been around the SPA/SSR world for more than a day.

Re:Fresh – Next-gen web framework by zwily on Tuesday June 14, 2022 @08:17AM (#31738079)
AFAIK, Vercel middlewares use Cloudflare Workers, which are V8 isolates. Describing that as a “janky JS sandbox” is pretty funny.
Re:Fresh – Next-gen web framework by moneywoes on Monday June 13, 2022 @10:26PM (#31734108)
What is the alternative for SSR?
Re:Fresh – Next-gen web framework by solardev on Monday June 13, 2022 @12:32PM (#31727833)
You can set next/image to work with Cloudinary or Imgix or a custom provider. It gets the job done that way, but yeah, the experience isn't as smooth as with Vercel.

Same with incremental static regeneration and some other features... Next is obviously built not just by, but also for, Vercel. Vendor lock-in already is a small issue and may become a bigger one if they keep going down that route.

Re:Fresh – Next-gen web framework by chrisco255 on Monday June 13, 2022 @01:14PM (#31728470)
They're working on that with Server Components: https://nextjs.org/blog/layouts-rfc?utm_source=next-site&utm...
Re:Fresh – Next-gen web framework by srigi on Thursday June 16, 2022 @03:33AM (#31763417)
Can you elaborate a little more, or navigate to some GH issue, where this is discussed, please?
Re:Fresh – Next-gen web framework by Hedepig on Monday June 13, 2022 @01:43AM (#31721640)
Choosing the tool that fits best with the requirements saves a bunch of time during a project lifecycle.
Re:Fresh – Next-gen web framework by WuxiFingerHold on Monday June 13, 2022 @09:43AM (#31725437)
Depends on your SPA framework:

https://hackernews-csr.ryansolid.workers.dev/

No need for rehydration, I'd say. Combine this with code splitting for large apps.

Re:Fresh – Next-gen web framework by mikojan on Monday June 13, 2022 @12:06PM (#31727429)
Maybe besides the point but this is falling back behind modern HTML[0] in that it is reintroducing flashes of blank pages.

It's not a nice experience. Remix (and, most likely, Fresh as well) prevents this.

[0]: https://developer.chrome.com/blog/paint-holding/

Re:Fresh – Next-gen web framework by inglor on Monday June 13, 2022 @03:05AM (#31722196)
check out Qwik (by Misko Hevery the author of Angular) which does (much) smarter hydration than Next (or this Fresh thing)
Re:Fresh – Next-gen web framework by stoicjumbotron on Monday June 13, 2022 @10:03AM (#31725721)
Yeah, I too have been meaning to try it out. I guess the "barrier" for me is the ecosystem surrounding it.