News for hackers. Stuff that matters.
Re:GitHub is replacing Rails front end rendering with React by ronnier on Saturday November 12, 2022 @05:07PM (#33577616)
I don't have any data to back this up, just my opinion, but I prefer backend rendered sites with Javascript augmentation for the parts that need it. Just feels faster.

These JavaScript UIs feel clunky and slow IMO. Maybe it's the (sometimes) dozens of calls the UI make back to the server to get data whereas if it was all rendered in the backend the round trip time would be a lot faster since the server is closer to the data, but my browser needs to make a call across the internet to the server and then to the database or whatever.

Also for tools websites at companies I work at, as a backend dev, building those tools in react is huge overhead. Webpack and react and redux etc. It's a lot to deal with for some simple tool. I'm wondering how much internal tool websites built in react slow down the development process at corps.

Re:GitHub is replacing Rails front end rendering with React by 323 on Saturday November 12, 2022 @05:21PM (#33577746)
In theory React websites should transfer less data since you just send a JSON model instead of one annotated in full HTML markup. The React runtime would be cached after the first visit.
Re:GitHub is replacing Rails front end rendering with React by martinald on Saturday November 12, 2022 @05:52PM (#33577977)
The problem isn't the amount of data but the number of round trips required to get it.

Imagine you need to do the following calls to get the page rendered with the various information different parts of the page has:

1. Get user information

2. Get projects for user

3. Get the selected project

Now, if this was all server side rendered, it might take 1ms to go to the database and get the various bits of info, or 3ms for 3 sequential requests.

With a react app and say 250ms of latency to the database, you're looking at 750ms of overhead - 200x slower.

Of course you can architect all your APIs to always return everything the user needs so they don't have to do multiple requests, but that has its own drawbacks and honestly is very difficult to do and plan ahead for, especially at scale with multiple consumers of various APIs.

Re:GitHub is replacing Rails front end rendering with React by lomereiter on Saturday November 12, 2022 @05:55PM (#33578005)
What you describe is solved with GraphQL, which is a very mature technology by now.
Re:GitHub is replacing Rails front end rendering with React by ronnier on Saturday November 12, 2022 @06:01PM (#33578064)
Now we are in the world of graphql, react (and all the other stuff that comes to react), plus the backend server and language. It's a complicated world and I'm not sure we really need that much complexity. There are times when it is needed but I think we've over done it in some cases where we can just have a golang or ruby backend server that renders the page server side. I recently did this and it's a very good feeling just sticking to my server side language that I use daily + html.
Re:GitHub is replacing Rails front end rendering with React by lomereiter on Saturday November 12, 2022 @06:13PM (#33578164)
Who are these 'we'? It's all up to personal preference in the end. As Github demonstrates by postponing SPA framework adoption, there are enough companies out there that share your desire to keep things simple.
Re:GitHub is replacing Rails front end rendering with React by ronnier on Saturday November 12, 2022 @07:03PM (#33578532)
We is our industry.
Re:GitHub is replacing Rails front end rendering with React by lomereiter on Saturday November 12, 2022 @07:49PM (#33578812)
Our industry is so disorganized that after half a century 'Software Engineer' is still not a recognized profession, and there is just as little interest in unionizing. I lack the audacity to make sweeping judgments about it.
Re:GitHub is replacing Rails front end rendering with React by cercatrova on Saturday November 12, 2022 @06:04PM (#33578090)
NextJS server side rendering and React Server Components basically solve this problem.
Re:GitHub is replacing Rails front end rendering with React by coffeefirst on Saturday November 12, 2022 @06:00PM (#33578051)
That’s the theory, but every time I measure it the combined data and JS needed to render it wind up being more than plain HTML both in bytes transferred and milliseconds to render.

There will be exceptions of course, but I haven’t found them.

Re:GitHub is replacing Rails front end rendering with React by throw_m239339 on Saturday November 12, 2022 @06:10PM (#33578141)
> These JavaScript UIs feel clunky and slow IMO

They don't feel slow, they are slow, even more so on mobile, but developers have stopped caring about mobile web performance a long time ago. So much for "flash is killing my battery", now it's Javascript.