Live data from Hacker News

Your single-page app is now a polyfill

itnext.io

161–164 of 164 posts

Re: Your single-page app is now a polyfill

#161
post #11

Please. Please don't do this. Service workers cause so many problems, I have never seen an implementation that didn't completely explode at some time or another, and as far as I can tell the only fix is to open the dev tools and delete service workers. They're a bad solution to a non-problem.

Clearing browser cache used to be our "have you turned it off and on again?" Looks like we need a "restore website to factory settings" which clears cache, cookies, service workers, offline storage, JIT of the code etc.

Re: Your single-page app is now a polyfill

#162
post #156

Earlier quoted context omitted.

> What's with the extremes? I'm not the one speaking in extremes. This is a quote: > The point is that it's faster and simpler to just have the server render the entire HTML and replace that That's childish analysis.

Seriously, you don't really seem to know what you're talking about. You can do it either way, and your particular example is a really poor reason to have a SPA. As multiple people are trying to tell you.

I don't know what I'm talking about, yet I build slick UIs for a living. Ok.

You are advocating for every action to take a server round trip to render, a client UI that consists of some hobbled-together mess of client JS, endpoint-rendered HTML, and worst-of-all extra server infra in order to facilitate it, when your client presents you with a perfect execution environment for a single application to transform data into semantic UIs.

I doubly enjoy that you didn't answer my earlier interpretation of your proposal, nor name any specifics of how you work, instead opting to swing back by once other people had sufficiently derailed the conversation.

Re: Your single-page app is now a polyfill

#163
post #159
post #155

Earlier quoted context omitted.

This is such a silly thought. I have to have a server which has to be capable of transforming data to valid HTML snippets which are aware of the context they'll be put into, a client which is capable of listening to clicks and then putting some data or snippets in some context it has to be aware of, and I have round-trips for everything even though I have a stateful client, and it's best if that stateful client is an…

You are not listening. You don’t need round trips. The same way your SPA receives its initial data from the server, you can send it as HTML (hidden) and just use JS to switch between the views. And there is nothing special about “understanding layout” on the server, you can run the exact same rendering code in the server with node. I’m not going to bother mentioning streaming html / progressive rendering, SEO, cachin…

>You are not listening. You don't need round trips.

Ok, so you've already proposed to me that my server not only needs to know how to load all the data, it also has to have an HTML renderer baked in, AND in your haste to say my SPA doesn't have any advantages, you've already forced your server to execute a layout algorithm on N graphs of unknown complexity, on your own machine & dime instead of your client's, just in order to accomplish what my SPA got for free: instantly rendering the next content when the user clicked.

The fact that you can come up with a list of things orthogonally related to serving web content that aren't solved any more gracefully with server-side rendering than an SPA - SEO, semantic content, accessibility - it's just silly. Same with this idea that you're going to pre-render the HTML into an ingenious layout where the user makes a series of actions that uncover nested HTML and don't require round-trips. It's as if you're ignoring that a primary benefit of SPAs is you can hide data loading really easily with prefetching JSON blobs and writing JS to navigate the tree. It's literally the language for the task.

It's exactly why I've not been shy to say this: anti-JS anti-SPA users get so bent out of shape that SPAs build nice UIs that they throw the baby out with the bathwater.

Re: Your single-page app is now a polyfill

#164

Earlier quoted context omitted.

> Ship your users an app including a copy of the data ahead of time I did exactly that with a hobby project ( https://www.acceleratul.ro/ ). The funny thing is that I had to add a short (~50ms) artificial delay with a spinner before showing search results, because people completely missed the fact that the page had refreshed

This is cool. What techniques did you use to include a copy of the data?

it's just a bunch of JSON bundled inside the rest of the JS assets with webpack
Post reply on HN