News for hackers. Stuff that matters.
Re:Ask HN: Has HN Had an Upgrade? by eps on Wednesday March 01, 2023 @06:14AM (#34981083)
HN backend sometimes is laggy preparing user-specific view of threads.
Re:Ask HN: Has HN Had an Upgrade? by qingdao99 on Wednesday March 01, 2023 @06:37AM (#34981226)
User-specific? Why isn't the page excluding the header part cached separately, or am I missing something?
Re:Ask HN: Has HN Had an Upgrade? by foldr on Wednesday March 01, 2023 @06:45AM (#34981281)
Presumably basic stuff like showing whether or not you've upvoted a comment and showing your own comments differently to other people's.
Re:Ask HN: Has HN Had an Upgrade? by tuukkah on Wednesday March 01, 2023 @07:06AM (#34981426)
It would be cheaper to render those afterwards client-side given a list of comment ids that the logged-in user has upvoted.
Re:Ask HN: Has HN Had an Upgrade? by proto_lambda on Wednesday March 01, 2023 @07:11AM (#34981468)
That would require users to run client-side scripts for basic site functionality.
Re:Ask HN: Has HN Had an Upgrade? by yardstick on Wednesday March 01, 2023 @07:19AM (#34981535)
Upvoting is a client-side script already.
Re:Ask HN: Has HN Had an Upgrade? by proto_lambda on Wednesday March 01, 2023 @07:21AM (#34981554)
Are you sure? With JS disabled, the vote arrows are simple links for me that work as expected.
Re:Ask HN: Has HN Had an Upgrade? by jraph on Wednesday March 01, 2023 @08:07AM (#34981939)
It's both! :-)

That's a perfect example of graceful degradation / progressive enhancement.

A JS event on the html element cancels clicks on those links and handles them in JS with AJAX so the page is not reloaded.

Re:Ask HN: Has HN Had an Upgrade? by tuukkah on Wednesday March 01, 2023 @07:51AM (#34981794)
Render server-side (or on the edge) for those who don't run client-side scripts.
Re:Ask HN: Has HN Had an Upgrade? by qingdao99 on Wednesday March 01, 2023 @08:55AM (#34982408)
Can that be detected by the site? (in a non-hacky way)
Re:Ask HN: Has HN Had an Upgrade? by tuukkah on Wednesday March 01, 2023 @09:32AM (#34982805)
Yes, by including code that if run, alters what happens. For example, you can add JavaScript code that handles the "comments" links on the front page in the new way (fetch the data and render it). For those browsers that don't run the code, everything will continue to work in the old way (links will cause a request to the server, which will render the comments).